package cn.fl.project.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.constant.SysUlFilesRecConstant;
import cmm.mid.core.framework.dto.BaseParamDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.IPriorityApiService;
import cmm.user.facade.system.dto.SysRoleDTO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.logger.eum.LogOperEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.commons.result.ResponseData;
import cn.fl.customer.service.ICstBankService;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.vo.CstBankVO;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.custpay.api.ICarLoanEpidemicApiService;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.insroute.service.IInsRouteBscInfoService;
import cn.fl.insroute.service.IInsRoutePrdInfoService;
import cn.fl.insroute.vo.InsRouteBscInfoVO;
import cn.fl.insroute.vo.InsRoutePrdInfoVO;
import cn.fl.preinsroute.condition.PreRoutePrdInfoQC;
import cn.fl.preinsroute.service.IPreRouteBscInfoService;
import cn.fl.preinsroute.service.IPreRouteInsResService;
import cn.fl.preinsroute.vo.PreRouteBscInfoVO;
import cn.fl.preinsroute.vo.PreRouteInsResVO;
import cn.fl.preinsroute.vo.PreRoutePrdInfoVO;
import cn.fl.preinsroute.vo.PreRoutePrpsFeeVO;
import cn.fl.preloan.IPrjBscInfoJcApiService;
import cn.fl.preloan.dto.prjbscinfojc.PrjBscInfoJcDTO;
import cn.fl.product.service.ISplBankService;
import cn.fl.product.vo.SplBankVO;
import cn.fl.project.api.IPrjPaySchMYqApiService;
import cn.fl.project.condition.*;
import cn.fl.project.constant.PrjBscInfoConstant;
import cn.fl.project.constant.PrjPrdBscInfoConstant;
import cn.fl.project.constant.PrjQuatPrpsFeeConstant;
import cn.fl.project.dto.PrjBscInfoDTO;
import cn.fl.project.dto.PrjCheckResultDTO;
import cn.fl.project.dto.PrjPaySchMYqDTO;
import cn.fl.project.service.*;
import cn.fl.project.transform.PrjBscInfoVOTransform;
import cn.fl.project.utils.GuidePcEditUtil;
import cn.fl.project.vo.*;
import cn.fl.rebacc.web.service.ISaleRebAccInfoService;
import cn.fl.rebacc.web.vo.SaleRebAccInfoVO;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.vo.SysCdMapDVO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import cvm.store.facade.cvm.api.IVechileStyleApiService;
import cvm.store.facade.cvm.condition.VechileStyleQC;
import cvm.store.facade.cvm.dto.VechileStyleDTO;
import fl.carloan.facade.carloan.api.IOdrPrdBscInfoApiService;
import fl.carloan.facade.carloan.api.IOdrQuatPrpsApiService;
import fl.carloan.facade.carloan.condition.OdrQuatPrpsQC;
import fl.carloan.facade.carloan.dto.OdrPrdBscInfoDTO;
import fl.carloan.facade.carloan.dto.OdrQuatPrpsDTO;
import fl.constant.facade.framework.constant.BusinessIdConstant;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.api.ICustomerQueryApiService;
import fl.customer.facade.customer.condition.CstBankQueryCondition;
import fl.customer.facade.customer.condition.CstCorpTeamQueryCondition;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.CstBankDTO;
import fl.customer.facade.customer.dto.CstBscInfoDTO;
import fl.customer.facade.customer.dto.CstCorpTeamDTO;
import fl.customer.facade.customer.dto.CstNpBscInfoDTO;
import fl.riskctrl.facade.externalinterface.service.api.IExternalRcCstBscInfoSearchApiService;
import fl.riskctrl.facade.externalinterface.service.condition.TheWorstRcCstBscInfoQC;
import fl.riskctrl.facade.externalinterface.service.dto.TheWorstRcCstBscInfoResult;
import fl.riskctrl.facade.riskctrl.api.IRiskCtrlSearchApiService;
import fl.riskctrl.facade.riskctrl.constant.EnumPrdTypCd;
import fl.riskctrl.facade.riskctrl.dto.RcCstBscInfoDTO;
import fl.riskctrl.facade.riskctrl.rccstchannelinfo.dto.RcCstChannelInfoDTO;
import fl.riskctrl.facade.riskctrl.riskctrlsingle.api.IRiskCtrlSingleApiService;
import fl.riskctrl.facade.riskctrl.riskctrlsingle.condition.RiskCtrlSingleResult;
import fl.spl.facade.lnkcomp.api.IPrjLnkCompQueryApiService;
import fl.spl.facade.lnkcomp.dto.PrjLnkCompBkAccDTO;
import fl.spl.facade.spl.condition.SplBankQueryCondition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import veh.src.facade.src.src.api.IVehSrcInfQueryApiService;
import veh.src.facade.src.src.dto.VehSrcInfDTO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 车型库
 * 作者:hongyanbo
 * 时间:2018/7/10
 */
@Controller
@RequestMapping("/project/vehicle")
public class VehicleStyleController extends BaseController {
    @Autowired
    private IProjectApiService projectApiService;
    @Autowired
    private ISplBankService splBankService;
    /**
     * 供应商返利账号
     */
    @Autowired
    private IPrjSplBankAccRService prjSplBankAccRService;
    @Autowired
    private IVehicleStyleService vehicleStyleService;
    @Autowired
    private IPrjBscInfoService prjBscInfoService;
    @Autowired
    private IPrjQuatPrpsCfgMService prjQuatPrpsCfgMService;//项目报价方案配置主信息表
    @Autowired
    private IRiskCtrlSearchApiService riskCtrlSearchApiService;//风控管理、配置、征信查询
    /**
     * 项目产品本地服务
     */
    @Autowired
    private IPrjPrdBscInfoService prjPrdBscInfoService;//项目产品基本信息表

    @Autowired
    private IOdrPrdBscInfoApiService odrPrdBscInfoApiService;

    @Autowired
    private IOdrQuatPrpsApiService odrQuatPrpsApiService;

    @Autowired
    private ICstBscInfoService cstBscInfoService;

    @Autowired
    private IRiskCtrlSingleApiService riskCtrlSingleApiService;
    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;

    @Autowired
    private ICstBankService cstBankService;

    @Autowired
    private ICustomerApiService customerApiService;

    @Autowired
    private IInsRouteBscInfoService insRouteBscInfoService;

    @Autowired
    private IInsRoutePrdInfoService insRoutePrdInfoService;

    /**
     * 车源查询
     */
    @Autowired
    private IVehSrcInfQueryApiService vehSrcInfQueryApiService;

    /**
     * 车型查询
     */
    @Autowired
    private IVechileStyleApiService styleApiService;

    @Autowired
    private ICarLoanEpidemicApiService carLoanEpidemicApiService;

    @Autowired
    public IExternalRcCstBscInfoSearchApiService externalRcCstBscInfoSearchApiService;

    @Autowired
    private ICustomerQueryApiService customerQueryApiService;

    @Autowired
    private IPrjPaySchMYqApiService prjPaySchMYqApiService;

    @Autowired
    private IPrjPrdPaySchMService prjPrdPaySchMService;

    @Autowired
    private IPrjPrdDtlService prjPrdDtlService;

    @Autowired
    private IPriorityApiService priorityApiService;

    @Autowired
    private IPreRouteBscInfoService preRouteBscInfoService;

    @Autowired
    private IPreRouteInsResService preRouteInsResService;

    @Autowired
    private IPrjLnkCompService prjLnkCompService;

    @Autowired
    private ISplBankService prdSplBankService;

    @Autowired
    private ISaleRebAccInfoService saleRebAccInfoService;

    @Autowired
    private IPrjBscInfoJcApiService prjBscInfoJcApiService;

    @Autowired
    private IPrjLnkCompQueryApiService prjLnkCompQueryApiService;

    /**
     * 日志
     */
    private static final Logger logger = LoggerFactory.getLogger(VehicleStyleController.class);

    /**
     * 车型列表
     * @param view
     * @param prjId 项目id
     * @return
     */
    @RequestMapping("vehicleList.do")
    public ModelAndView toListPage(ModelAndView view ,Long prjId,HttpServletRequest request){
        view.setViewName("project/vehicle/vehicleList");
        view.addObject("prjId",prjId);
        String prjPrdChangeFlag = request.getParameter("prjPrdChangeFlag");
        String oldDtlId = request.getParameter("oldDtlId");
        //启用支付表信息
        String paySchId = request.getParameter("paySchId");
        String paySchNo = request.getParameter("paySchNo");
        view.addObject("prjPrdChangeFlag",prjPrdChangeFlag);
        view.addObject("oldDtlId",oldDtlId);
        view.addObject("paySchId",paySchId);
        view.addObject("paySchNo",paySchNo);
        return view;
    }

    /**
     * 车型列表
     * @param view
     * @param prjId 项目id
     * @return
     */
    @RequestMapping("vehicleListRoute.do")
    public ModelAndView vehicleListRoute(ModelAndView view ,Long prjId,HttpServletRequest request){
        String brId = request.getParameter("brId");
        String modelId = request.getParameter("modelId");
        String prdId = request.getParameter("prdId");
        String insRoutePrdId = request.getParameter("insRoutePrdId");
        view.setViewName("project/vehicle/vehicleListRoute");
        view.addObject("prjId",prjId);
        view.addObject("brId",brId);
        view.addObject("modelId",modelId);
        view.addObject("prdId",prdId);
        view.addObject("insRoutePrdId",insRoutePrdId);
        return view;
    }

    /**
     * 车型查询
     * initList
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping("initList.do")
    @ResponseBody
    public Object initList(int page, int pagesize, VechileStyleQC condition){
        Pager pager = new Pager();
        pager.setCurrentPage(page);
        pager.setEveryPage(pagesize);
        pager.setCondition(condition);
        condition.setIsTrailerSelect(false);
        pager = vehicleStyleService.selectListPage(pager);
        List<VechileStyleDTO> resultList = (List<VechileStyleDTO>) pager.getResultList();

        ListPageVO<VechileStyleDTO> listPage = new ListPageVO<VechileStyleDTO>(resultList, pager.getTotalCount());
        return listPage;
    }

    /**
     * 到产品详细信息页面
     * @Param prjId 项目id
     * @Param id 车型styleId
     * @param purposeCd 用途代码
     */
    @RequestMapping(value = "/toPrjPrdDetailPage.do", method = {RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toPrjPrdDetailPage(HttpServletRequest request,Long prjId,Long id ,Long purposeCd) {
        BaseLogUtils.newWebLogger("===产品详细信息参数:" + this.getRequestParameter(request)).info();
        String prdDetailId = request.getParameter("id");//车型id
        String prdDtlId = request.getParameter("id");// 产品明细ID180510070000365
        String carSourceId = request.getParameter("carSourceId");
        String insRoutePrdId = request.getParameter("insRoutePrdId");
        BaseLogUtils.newWebLogger("==获取车源id=carSourceId:" + carSourceId).info();
        // 产品计量单位类型
        List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
        // 品牌类别
        List<KeyValueVO> brTypCdList = this.prjBscInfoService.getBrTypCdList();
        // 产品种类
        List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();
        // 保险购买方式
        List<KeyValueVO> buyWayCdList = this.prjBscInfoService.getBuyWayCdList();
        List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
        List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();
        // 根据产品分类查询产品信息
        String prdType = "";
        ModelAndView view = new ModelAndView("project/vehicle/projectPrdInfoAdd");
        PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        /**
         * 车辆参考价是否可编辑标志,0-否,1-是
         * 这里要定义车辆参考价是否可编辑规则
         */
        PrjBscInfoDTO prjBscInfoDTO = PrjBscInfoVOTransform.toDTO(bscVo);
        //根据项目id查询经销商报单带出 经销商
        ResponseData<PrjBscInfoJcDTO> responseData = prjBscInfoJcApiService.getPrjBscInfoJcDetail(prjId);
        if(responseData.isSuccess() && responseData.getData() != null){
            PrjBscInfoJcDTO prjBscInfoJcDTO = responseData.getData();
            view.addObject("splId",prjBscInfoJcDTO.getSplId());
            view.addObject("splNm",prjBscInfoJcDTO.getSplNm());
        }
        //根据项目ID查看是否关联路由信息
        InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(prjBscInfoDTO.getId());
        BaseLogUtils.newWebLogger("根据项目ID查看是否关联路由信息 项目ID=" + prjBscInfoDTO.getId() + "路由结果=" + JSON.toJSONString(insRouteBscInfoVO)).info();
        if (insRouteBscInfoVO != null) {
            prjBscInfoDTO.setInsPrjRelateFlag(BaseConstant.IS_YESNO_YES_STR);
        }
        view.addObject("guidePcEditFlag", GuidePcEditUtil.getGuidePcEditFlag(prjBscInfoDTO));

        List<KeyValueVO> keyValueVOList = new ArrayList<KeyValueVO>();
        //车抵贷业务（承租人自然人的情况 收款方类型三种 法人 只有经销商） 非车抵贷业务收款方类型只有经销商  -》返回收款方列表
        String prjTypCd = bscVo.getPrjTypCd();
        //判断承租人是否法人
        Long cstId = bscVo.getCstId();
        CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectById(cstId);
        String cstTypeCd = cstBscInfoVO.getCstTypCd();
        view.addObject("cstTypeCd",cstTypeCd);
        if(StringUtils.isNotBlank(prjTypCd) && (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){//车抵贷业务、内转交易贷
            /*CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectById(cstId);
            String cstTypeCd = cstBscInfoVO.getCstTypCd();*/
            if(StringUtils.isNotBlank(cstTypeCd) && cstTypeCd.equals(CustomerConstant.CST_TYP_CD_NP)){
                keyValueVOList = this.vehicleStyleService.getReceiveTypeCdList();
            }else{
                KeyValueVO keyValueVO = new KeyValueVO();
                keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                keyValueVO.setValue("供应商");
                keyValueVOList.add(keyValueVO);
            }
        }else{
            KeyValueVO keyValueVO = new KeyValueVO();
            keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
            keyValueVO.setValue("供应商");
            keyValueVOList.add(keyValueVO);
        }
        view.addObject("receiveTypeCdList",keyValueVOList);
        String receiveTypeCd = CapitalConstant.CODE_PAYEE_TYP_CD_1;
        //前置征信客户ID
        RcCstBscInfoDTO rcCstBscInfo = null;
        Boolean isCheck = false;
        if(StringUtils.isNotEmpty(bscVo.getRcCstBscInfoId())){
            isCheck = true;
            //获取原来的供货商
            rcCstBscInfo = riskCtrlSearchApiService.getRcCstBscInfoById(bscVo.getRcCstBscInfoId());
        }
        Long accId = null;//供应商账号id
		String accNo = "";//供应商账号
		 Long backAccId = null;//供应商返利id
        String backAccNo="";// 供应商返利账号
        Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
        Long salBackAccId = null;//销售返利id
        String salBackAccNo="";// 销售账号
        Long compensatoryAccId = null;//代偿担保账号id
        String compensatoryAccNo = "";//代偿担保账号
        String compensatorySplRcptUnt = "";//代偿支付账户
        String compensatorySplBkNm = "";//代偿担保账号开户行
        String compensatorySplBkNo = "";//代偿担保开户行行号

        Long depositAccId = null;//保证金担保账号id
        String depositAccNo = "";//保证金担保账号
        String depositSplRcptUnt = "";//保证金支付账户
        String depositSplBkNm = "";//保证金担保账号开户行
        String depositSplBkNo = "";//保证金担保开户行行号

        Integer hasSalBackNo = BaseConstant.IS_YESNO_NO;
        Integer hasAccNoFlag = BaseConstant.IS_YESNO_NO;//是否有放款账号
		Integer hasBackNoFlag = BaseConstant.IS_YESNO_NO;//是否已经有了返利账号
        boolean tkFlag = false;

        SysCdMapDVO map = this.prjPrdBscInfoService.searchBizCodeByPrdCd(prdType);
//        SysCdMapDVO plcyMap = this.prjPrdBscInfoService.searchPlcyMapByPrdCd(prdCd);
        List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();
    	//查询是否有返利账号，如果有则直接带出不能修改
		PrjPrdBscInfoQueryCondition prdBscQc = new PrjPrdBscInfoQueryCondition();
		prdBscQc.setPrjId(Long.valueOf(prjId));
		List<PrjPrdBscInfoVO> prjPrdList = this.prjPrdBscInfoService.searchList(prdBscQc);
        view.addObject("isCanEditRecommendSpl", "1");
        view.addObject("isCanEditLnkCompInfo", "1");
        view.addObject("isCanEditCompensatorySplInfo", "1");
        view.addObject("isCanEditDepositSplInfo", "1");
        view.addObject("compensatoryType", prjBscInfoDTO.getCompensatoryType() == null ? "0" : prjBscInfoDTO.getCompensatoryType());
        if(CollectionUtils.isNotEmpty(prjPrdList)){
            //第一台车
            PrjPrdBscInfoVO prdBscInfo = prjPrdList.get(prjPrdList.size() - 1);
            if(bscVo.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC) && prdBscInfo.getRecommendSplId() != null){
                view.addObject("recommendSplId", prdBscInfo.getRecommendSplId());
                view.addObject("recommendSplNm", prdBscInfo.getRecommendSplNm());
                view.addObject("isCanEditRecommendSpl", "0");
            }
            if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) && (bscVo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CTYW) || bscVo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW))){
                PrjPrdDtlQueryCondition prjPrdDtlQueryCondition = new PrjPrdDtlQueryCondition();
                prjPrdDtlQueryCondition.setPrjPrdId(prdBscInfo.getId());
                PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectOneByCondition(prjPrdDtlQueryCondition);
                view.addObject("prjPrdDtlVO",prjPrdDtlVO);
                view.addObject("isCanEditLnkCompInfo", "0");

                view.addObject("guaranteePaymentType", prdBscInfo.getGuaranteePaymentType());
                view.addObject("guaranteePaymentId", prdBscInfo.getGuaranteePaymentId());
                view.addObject("guaranteePaymentNm", prdBscInfo.getGuaranteePaymentNm());
                view.addObject("isCanEditCompensatorySplInfo", "0");
                view.addObject("isCanEditDepositSplInfo", "0");

                //取第一台车的代偿担保账号
                if (CollectionUtils.isNotEmpty(prdBscInfo.getPrjSplBankAccRVOList())) {
                    for (PrjSplBankAccRVO splBankAcc : prdBscInfo.getPrjSplBankAccRVOList()) {
                        //渠道为经销商 取经销商账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP)) {
                            compensatoryAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                            if (null != splBankVO) {
                                compensatoryAccNo = splBankVO.getAccNo();
                                compensatorySplRcptUnt = splBankVO.getRcptUnt();
                                compensatorySplBkNm = splBankVO.getBkNm();
                                compensatorySplBkNo = splBankVO.getBkNo();
                            }
                        }
                        //渠道为挂靠公司 取挂靠公司账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_COMPENSATORY_BANK_NO_TYP)) {
                            compensatoryAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(compensatoryAccId,"11000","0000");
                            if (null != prjLnkCompBkAccDTO) {
                                compensatoryAccNo = prjLnkCompBkAccDTO.getAccNo();
                                compensatorySplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                compensatorySplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                compensatorySplBkNo = prjLnkCompBkAccDTO.getBkNo();
                            }
                        }

                        //渠道为经销商 取经销商账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_DEPOSIT_BANK_NO_TYP)) {
                            depositAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            SplBankVO splBankVO = this.prdSplBankService.selectById(depositAccId);
                            if (null != splBankVO) {
                                depositAccNo = splBankVO.getAccNo();
                                depositSplRcptUnt = splBankVO.getRcptUnt();
                                depositSplBkNm = splBankVO.getBkNm();
                                depositSplBkNo = splBankVO.getBkNo();
                            }
                        }
                        //渠道为挂靠公司 取挂靠公司账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_DEPOSIT_BANK_NO_TYP)) {
                            depositAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                            if (null != prjLnkCompBkAccDTO) {
                                depositAccNo = prjLnkCompBkAccDTO.getAccNo();
                                depositSplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                depositSplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                depositSplBkNo = prjLnkCompBkAccDTO.getBkNo();
                            }
                        }
                    }
                }
            }
            view.addObject("compensatorySplAccNoId", compensatoryAccId);
            view.addObject("compensatorySplAccNoNm", compensatoryAccNo);
            view.addObject("compensatorySplRcptUnt", compensatorySplRcptUnt);
            view.addObject("compensatorySplBkNm", compensatorySplBkNm);
            view.addObject("compensatorySplBkNo", compensatorySplBkNo);

            view.addObject("depositSplAccNoId", depositAccId);
            view.addObject("depositSplAccNoNm", depositAccNo);
            view.addObject("depositSplRcptUnt", depositSplRcptUnt);
            view.addObject("depositSplBkNm", depositSplBkNm);
            view.addObject("depositSplBkNo", depositSplBkNo);
			if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) &&prjPrdList.size()>=1){
        		hasBackNoFlag = BaseConstant.IS_YESNO_YES;
        	}
			//第一台车
			PrjPrdBscInfoVO prdBscInfoVO = 	prjPrdList.get(prjPrdList.size()-1);
            receiveTypeCd = prdBscInfoVO.getReceiveTypeCd();
			//查找返利账号，销售返利账号
			 List<Long> accNoIdList = new ArrayList<Long>();
		        PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
		        accQc.setPrjPrdId(prdBscInfoVO.getId());
		        List<String> purpCdList = new ArrayList<String>();
		        purpCdList.add(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP);
		        purpCdList.add(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP);
		        accQc.setPurpCds(purpCdList);
		        List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
		        if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
		            for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
		                accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
		                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
		                    backAccId = prjSplBankAccRVO.getSplAccNoId();
		                    hasSplBackNo = BaseConstant.IS_YESNO_YES;
		                }
		                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP)){
		                    salBackAccId = prjSplBankAccRVO.getSplAccNoId();
		                    hasSalBackNo = BaseConstant.IS_YESNO_YES;
		                }
		            }
		        }
		        PrjSplBankAccRQueryCondition splAccQc = new PrjSplBankAccRQueryCondition();
		        splAccQc.setPrjPrdId(prdBscInfoVO.getId());
		        splAccQc.setPurpCd(PrjPrdBscInfoConstant.SPL_BANK_NO_TP);
		        List<PrjSplBankAccRVO> splAccRVOList = 	this.prjSplBankAccRService.searchList(splAccQc);
		        if(CollectionUtils.isNotEmpty(splAccRVOList)){
		                accNoIdList.add(splAccRVOList.get(0).getSplAccNoId());
	                    accId = splAccRVOList.get(0).getSplAccNoId();
                        CstBankDTO dto = this.customerApiService.selectCstBankById(accId);
                        if(dto!=null){
                            accNo = dto.getAccNo();
                        }
		        }
		        if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) &&bscVo.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC)
		        		&&prjPrdList.size()>=1){
                	hasAccNoFlag = BaseConstant.IS_YESNO_YES;//重卡电子合同不可以修改放款账号
                }
		        if(CollectionUtils.isNotEmpty(accNoIdList)){
		            Pager page = new Pager();
		            page.setCurrentPage(1);
		            page.setEveryPage(Integer.MAX_VALUE);
		            SplBankQueryCondition qc = new SplBankQueryCondition();
		            qc.setIdList(accNoIdList);
		            page.setCondition(qc);
		            Pager pager= 	 this.splBankService.searchListPage(page);
		            List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
		            if(CollectionUtils.isNotEmpty(list)){
		                for (SplBankVO splBankVO : list) {
		                	 if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
		                         accNo = splBankVO.getAccNo();
		                     }
		                    if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
		                        backAccNo = splBankVO.getAccNo();
		                    }
		                    if(null!=salBackAccId&&splBankVO.getId().equals(salBackAccId.longValue())){
		                    	salBackAccNo = splBankVO.getAccNo();
		                    }
		                }
		            }
		        }
		        view.addObject("splId", prdBscInfoVO.getSplId());
	            view.addObject("splNm", prdBscInfoVO.getSplNm());
		}

        view.addObject("receiveTypeCd",receiveTypeCd);
        view.addObject("isCheck", isCheck);//是否默认供应商
        //渠道担保支付主体列表
        List<KeyValueVO> guaranteePaymentTypeList = this.prjBscInfoService.getGuaranteePaymentTypeList();
        view.addObject("guaranteePaymentTypeList", guaranteePaymentTypeList);
        /*if(!(StringUtils.isNotBlank(prjTypCd)
                && prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)
                && !(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_1)))){//车抵贷业务
            if(rcCstBscInfo != null){
                view.addObject("splId", rcCstBscInfo.getSplId());
                view.addObject("splNm", rcCstBscInfo.getSplNm());
            }
        }*/
        //TODO (如果是电子合同且不是第一台车，显示第一台车的推荐经销商)
        view.addObject("styleId",id);
        view.addObject("prdDetailId", prdDetailId);
        view.addObject("prdUntCdList", prdUntCdList);
//        view.addObject("plcyTcode", null==plcyMap?"":plcyMap.getTCode());
        view.addObject("yesNoCdList", yesNoCdList);
        view.addObject("vehCheckCdList", vehCheckCdList);

        view.addObject("tkFlag", tkFlag);
        view.addObject("prjId", prjId);
        view.addObject("prdDtlId", prdDtlId);
        view.addObject("brTypCdList", brTypCdList);
        view.addObject("prdClsCdList", prdClsCdList);
        view.addObject("buyWayCdList", buyWayCdList);
        view.addObject("buOrgCd", bscVo.getBuOrgCd());
        view.addObject("prjTypCd", bscVo.getPrjTypCd());
        view.addObject("isSplMfr", bscVo.getIsSplMfr());
        view.addObject("insCode", bscVo.getInsCode());
    	view.addObject("accId", accId);
		view.addObject("accNo", accNo);
		view.addObject("backAccId", backAccId);
		view.addObject("backAccNo", backAccNo);
		view.addObject("hasAccNoFlag", hasAccNoFlag);
		view.addObject("hasSplBackNo", hasSplBackNo);
		view.addObject("hasBackNoFlag", hasBackNoFlag);
	    view.addObject("salBackAccId", salBackAccId);
        view.addObject("salBackAccNo", salBackAccNo);
        view.addObject("hasSalBackNo", hasSalBackNo);
        view.addObject("licenseCdList", licenseCdList);
        String pCd = "";
        if(StringUtils.isNotBlank(carSourceId)){
            view.addObject("prdTypCd", purposeCd);
        }else{
             pCd = this.vehicleStyleService.getPurposePCd(purposeCd);
            view.addObject("prdTypCd", pCd);
        }
        // 参配信息动态页面bizCd 这个需要组织机构
        view.addObject("bizCd",bscVo.getBuOrgCd() + pCd);
        // 二手车页面bizCd 这个不需要区分组织机构
        view.addObject("simpleBizCd",pCd);
        view.addObject("pCd",purposeCd);
        view.addObject("bizTypCd","CVM0001");
    	view.addObject("prdCd", purposeCd);//二级分类
        view.addObject("carSourceId", carSourceId);
        if(StringUtils.isNotEmpty(insRoutePrdId)){
            InsRoutePrdInfoVO insRoutePrdInfoVO = this.insRoutePrdInfoService.selectById(Long.valueOf(insRoutePrdId));
            Double insCustFina = 0d;
            Double insGuidPc = DecimalUtils.convertFenToYuan(insRoutePrdInfoVO.getGuidePc().longValue());
            if(insRoutePrdInfoVO!=null){
                view.addObject("prdQty", insRoutePrdInfoVO.getPrdQty());
                if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd)){
                    String vehNo = insRoutePrdInfoVO.getVehNo();
                    Long preRouteId = bscVo.getPreRouteId();
                    Long preResId = bscVo.getPreResId();
                    if(preRouteId != null && preResId != null){
                        PreRouteBscInfoVO preRouteBscInfoVO = this.preRouteBscInfoService.selectPreRouteBscInfoAllById(preRouteId);
                        List<PreRoutePrdInfoVO> preRoutePrdInfoVOS = preRouteBscInfoVO.getPreRoutePrdInfoVOS();
                        if(CollectionUtils.isNotEmpty(preRoutePrdInfoVOS)){
                            for (PreRoutePrdInfoVO preRoutePrdInfoVO : preRoutePrdInfoVOS) {
                                if(preResId.equals(preRoutePrdInfoVO.getResId()) && vehNo.equals(preRoutePrdInfoVO.getVehNo())){
                                    List<PreRoutePrpsFeeVO> preRoutePrpsFeeVOS = preRoutePrdInfoVO.getPreRoutePrpsFeeVOS();
                                    for (PreRoutePrpsFeeVO preRoutePrpsFeeVO : preRoutePrpsFeeVOS) {
                                        if( PrjQuatPrpsFeeConstant.FEE_TYP_CD_01.equals(preRoutePrpsFeeVO.getFeeTypCd())){
                                            insCustFina = insGuidPc + DecimalUtils.convertFenToYuan(insRoutePrdInfoVO.getMediationFeeAmt()) - preRoutePrpsFeeVO.getFeeAmt();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    view.addObject("insGuidPc", insGuidPc);
                    view.addObject("insCustFina",insCustFina);
                }
            }
        }
        view.addObject("insRoutePrdId", insRoutePrdId);
        //是否展示二手车车辆评估检测报告
        view.addObject("isShowPdfFilepath", false);
        return view;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/addPrdAndPrdDetail.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object addPrdAndPrdDetail(HttpServletRequest request,PrjPrdExtVO extDTO) throws BaseException {
        BaseLogUtils.info(logger,"addPrdAndPrdDetail","addPrdAndPrdDetail新增产品信息入参request=" + this.getRequestParameter(request)
            + ",extDTO=" + JSON.toJSONString(extDTO));
        String reqPrjId = request.getParameter("prjid");
        String prdType = request.getParameter("prdCd");
        String prdBaseInfoId = request.getParameter("prdbscInfoId");
        String rcCstBscInfoId = request.getParameter("rcCstBscInfoId");
        String brCd = request.getParameter("brCdNm");
        String custFina = request.getParameter("custFina");//客户融资额
        String vehVal = request.getParameter("vehVal");//车辆估值
        String insRoutePrdId = request.getParameter("insRoutePrdId");//路由ID
        String splId = request.getParameter("splId");
        String receiveTypeCd = request.getParameter("receiveTypeCd");
        String info = "";

        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
                "新增成功!");
        try {
            // 项目产品基础信息
            PrjPrdBscInfoVO prdBscInfoVO = getPrdBscInfoRequestParams(request);
            BaseLogUtils.info(logger,"addPrdAndPrdDetail","返回的产品项目基础信息prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO));
            prdBscInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
            prdBscInfoVO.setCrtTm(new Date());
            String rlRcCstId = null;
            Long prjId = prdBscInfoVO.getPrjId();
            PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(prjId);
            String prjTypCd = prjBsc.getPrjTypCd();
            BaseLogUtils.info(logger,"addPrdAndPrdDetail","项目id为" + prjId + "项目类型" + prjTypCd + "前置征信id为" + rcCstBscInfoId);
            if ("CDDYWYQ".equals(prjTypCd) && StringUtils.isEmpty(rcCstBscInfoId)) {
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","疫情项目查询征信开始...");
                Long cstId = prjBsc.getCstId();
                Long cstMgrId = prjBsc.getCstMgrId();
                CstBscInfoDTO cstBscInfoDTO = this.customerQueryApiService.getCstBscInfoById(cstId);
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","疫情项目根据客户经理查询承租人征信客户信息：" + JSON.toJSONString(cstBscInfoDTO));
                String cstTypCd = cstBscInfoDTO.getCstTypCd();
                prdBscInfoVO.setSplNm(cstBscInfoDTO.getCstNm());
                String certNo = "";
                String mp1 = "";
                String cstNm = cstBscInfoDTO.getCstNm();
                if(StringUtils.isNotBlank(cstTypCd) && cstTypCd.equals(CustomerConstant.CST_TYP_CD_NP)){//自然人
                    certNo = cstBscInfoDTO.getCertNo();
                    CstNpBscInfoDTO cstNpBscInfo = this.customerQueryApiService.getCstNpBscInfoById(cstId);
                    if(cstNpBscInfo == null || StringUtils.isEmpty(cstNpBscInfo.getMp1())){
                        throw new BaseException("客户信息异常");
                    }
                    mp1 = cstNpBscInfo.getMp1();
                }else if(StringUtils.isNotBlank(cstTypCd) && cstTypCd.equals(CustomerConstant.CST_TYP_CD_CORP)){//法人  法人代表的证件号？
                    CstCorpTeamQueryCondition condition = new CstCorpTeamQueryCondition();
                    condition.setCstId(cstId);
                    condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
                    condition.setIsDel(BaseConstant.IS_YESNO_NO);
                    condition.setmTypCd(CustomerConstant.CST_CORP_TEAM_LOWER);
                    List<CstCorpTeamDTO> cstCorpTeamDTOList = this.customerApiService.searchCstCorpTeamList(condition);
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","疫情项目根据客户经理查询承租人征信法人团队信息：" + JSON.toJSONString(cstCorpTeamDTOList));
                    if(CollectionUtils.isNotEmpty(cstCorpTeamDTOList)){
                        for(CstCorpTeamDTO cstCorpTeamDTO : cstCorpTeamDTOList){
                            if(StringUtils.isNotBlank(cstCorpTeamDTO.getCertNo())){
                                certNo = cstCorpTeamDTO.getCertNo();
                                mp1 = cstCorpTeamDTO.getMp1();
                                break;
                            }
                        }
                    }
                }
                TheWorstRcCstBscInfoQC theWorstRcCstBscInfoQC = new TheWorstRcCstBscInfoQC();
                BaseParamDTO baseParamDTO = new BaseParamDTO();
                theWorstRcCstBscInfoQC.setCertNo(certNo);
                theWorstRcCstBscInfoQC.setCstMgrId(cstMgrId);
                theWorstRcCstBscInfoQC.setMp1(mp1);
                theWorstRcCstBscInfoQC.setCstNm(cstNm);
                theWorstRcCstBscInfoQC.setEnumPrdTypCd(EnumPrdTypCd.YQXD);
                baseParamDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
                baseParamDTO.setServiceCd(CurrentThreadContext.getFlServiceSysCd());
                baseParamDTO.setFrontCd(CurrentThreadContext.getCurrentSysCd());
                baseParamDTO.setChannelCd(WebBaseConstant.CHANNEL_CD);
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","疫情项目根据客户经理查询承租人征信参数certNo=" + certNo + "-cstMgrId" + cstMgrId);
                cmm.mid.core.framework.dto.DataResultDTO resultDTO = this.externalRcCstBscInfoSearchApiService.getTheWorstRcCstBscInfo(theWorstRcCstBscInfoQC,null,baseParamDTO);
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","疫情项目根据客户经理查询承租人征信结果：" + JSON.toJSONString(resultDTO));
                if(resultDTO!=null && resultDTO.getSuccess() == BaseConstant.IS_YESNO_YES) {
                    TheWorstRcCstBscInfoResult rcCstCddunderlineBody = (TheWorstRcCstBscInfoResult) (resultDTO.getData());
                    BaseLogUtils.info(logger, "addPrdAndPrdDetail", "疫情项目根据客户经理查询承租人征信DATA：" + JSON.toJSONString(rcCstCddunderlineBody));
                    if (rcCstCddunderlineBody != null) {
                        rcCstBscInfoId = rcCstCddunderlineBody.getRcCstBscInfoId().toString();
                        BaseLogUtils.info(logger, "addPrdAndPrdDetail", "疫情项目根据客户经理查询承租人征信rcCstBscInfoId：" + rcCstBscInfoId);
                    }
                }
            }
            //校验配偶征信信息
            if((prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)|| prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))&&prjBsc.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)&&StringUtils.isBlank(prjBsc.getInsCode())) {
                if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)){
                    if(StringUtils.isBlank(rcCstBscInfoId)&&null==prjBsc.getRcCstBscInfoId()){
                        throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请先查询客户的征信信息！");
                    }
                    Long rcCstId = null;
                    if(StringUtils.isBlank(rcCstBscInfoId)){
                        rcCstId = prjBsc.getRcCstBscInfoId();
                    }else{
                        rcCstId = Long.valueOf(rcCstBscInfoId);
                    }
                    BaseParamDTO baseParamDTO = new BaseParamDTO();
                    baseParamDTO.setChannelCd("CHL0001");
                    baseParamDTO.setSysCd("11000");
                    baseParamDTO.setServiceCd("SVC0001");
                    baseParamDTO.setFrontCd("CHL0001");
                    DataResultDTO rcCstBscInfoResult = riskCtrlSingleApiService.searchRcCstBscInfoResult(rcCstId,baseParamDTO);
                    String  creditLvl = "";
                    if(null!=rcCstBscInfoResult && null!=rcCstBscInfoResult.getData()){
                        RiskCtrlSingleResult riskCtrlSingleResult = (RiskCtrlSingleResult) rcCstBscInfoResult.getData();
                        creditLvl = riskCtrlSingleResult.getRskLvlCd();//风险级别
                        Map<String,String>  map = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_CDD_QUAT_FST_PCT);
                        double firstPct = Double.valueOf(map.get(creditLvl));
                        double  contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(DecimalUtils.div(Double.valueOf(custFina),(1-firstPct/100),0)),0) ;
                        prdBscInfoVO.setGuidePc(contAmt);
                        prdBscInfoVO.setPrdAmt(contAmt);
                    }
                }else if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                    double contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(Double.valueOf(vehVal).doubleValue()),0);
                    prdBscInfoVO.setGuidePc(contAmt);
                    prdBscInfoVO.setPrdAmt(contAmt);
                }
            }

            if((prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)|| prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))&&prjBsc.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)&&StringUtils.isNotBlank(prjBsc.getInsCode())) {
                if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL) && prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_TJBANK)){
                    //天津银行指导价设置
                    double contAmt = this.getCDDContAmt(request);
                    prdBscInfoVO.setGuidePc(contAmt);
                    prdBscInfoVO.setPrdAmt(contAmt);
                }
                /**
                 * 设置江西金租 参考价 和 产品金额
                 */
                if(prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_JXFL)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_XYFL)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_CCBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_SYFL)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_HRBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_JXYMBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_TYFL)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_WEBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_TIANJINBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_YLBANK)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_SSFL)
                        || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_YBBANK)
                ){
                    double contAmt = 0d;
                    if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)){
                        if(prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_JXFL)
                                || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_XYFL)
                                || prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_SYFL)
                        ){
                            contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(Double.valueOf(custFina).doubleValue()),0);
                        }else{
                            contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(Double.valueOf(vehVal).doubleValue()),0);
                        }
                    }
                    if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                        contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(Double.valueOf(vehVal).doubleValue()),0);
                    }
                    if(PrjBscInfoConstant.PRJ_INS_CODE_SYFL.equals(prjBsc.getInsCode()) && prjBsc.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) &&
                            (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
                        if(DecimalUtils.div((prdBscInfoVO.getVehVal()-prdBscInfoVO.getCustFina()),prdBscInfoVO.getVehVal())*100 <= 30d){
                            BaseLogUtils.newWebLogger("报价方案首期比例不符合三一金融政策要求,首期比例：" + DecimalUtils.div((prdBscInfoVO.getGuidePc()-prdBscInfoVO.getCustFina()),prdBscInfoVO.getGuidePc())).info();
                            return new DataResultVO(BaseConstant.IS_YESNO_NO,"报价方案首期比例不符合三一金融政策要求");
                        }
                        prdBscInfoVO.setGuidePc(prdBscInfoVO.getVehVal());
                        prdBscInfoVO.setPrdAmt(prdBscInfoVO.getVehVal());
                    }else{
                        prdBscInfoVO.setGuidePc(contAmt);
                        prdBscInfoVO.setPrdAmt(contAmt);
                    }
                }
                if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL) && prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_XYFL) ){
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("重卡事业部兴业金租不支持车抵贷业务");
                    return result;
                }
            }
            /**
             * REQ-13176 车辆参考价和车辆估值大小进行校验(参考价<=车辆估值)
             * 我司业务 -->参考价大于车辆估值(存在情况)
             * 资管业务-->参考价大于车辆估值(不存在这种情况)
             * 关联路由以路由结果未准,未关联路由以预筛选为准(尽量走资管业务)
             *
             * 1.关联路由信息,且为资管,需校验
             * 2.未关联路由
             *     2.1. 未关联预筛选,需校验
             *     2.2. 关联预筛选且为资管,需校验
             */
            if (prjBsc != null &&
                    (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd)
                        || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd)
                        || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))
            ) {
                String tempGuidePc = request.getParameter("guidePc");//车辆参考价
                String tempVehVal = request.getParameter("vehVal");//车辆估值
                boolean guidePcVehValChickFlag = false; //参考价车辆估值校验Flag
                if(StringUtils.isEmpty(tempGuidePc) || StringUtils.isEmpty(tempVehVal)){
                    throw new BaseException("车辆参考价或车辆估值为空,产品信息异常");
                }
                //项目是否关联路由信息
                InsRouteBscInfoVO insRouteBscInfoVOTemp = this.insRouteBscInfoService.searchListByPrjId(prjBsc.getId());
                logger.info("根据项目ID查看关联路由信息 项目ID={},路由结果={}",prjBsc.getId(),JSON.toJSONString(insRouteBscInfoVOTemp));
                if (insRouteBscInfoVOTemp != null) {
                    //关联路由,根据项目信息中是否资管业务判断
                    if (prjBsc.getIsInsBiz() != null && prjBsc.getIsInsBiz().intValue() == BaseConstant.IS_YESNO_YES) {
                        guidePcVehValChickFlag = true;
                    }
                } else {
                    //项目是否关联预筛选信息
                    if (prjBsc.getPreResId() == null) {
                        guidePcVehValChickFlag = true;
                    } else {
                        //查看预筛选结果信息
                        PreRouteInsResVO preRouteInsResVOTemp = this.preRouteInsResService.selectById(prjBsc.getPreResId());
                        logger.info("根据预筛选结果ID查看预筛选结果信息 项目ID={},预筛选ID={},预筛选结果ID={},预筛选结果信息={}",
                                prjBsc.getId(),prjBsc.getPreRouteId(),prjBsc.getPreResId(),JSON.toJSONString(preRouteInsResVOTemp));
                        if (preRouteInsResVOTemp != null && StringUtils.isNotEmpty(preRouteInsResVOTemp.getInsCode())) {
                            guidePcVehValChickFlag = true;
                        }
                    }
                }
                logger.info("根据项目ID校验参考考和车辆估值大小 项目ID={},guidePcVehValChickFlag={},tempGuidePc={},tempVehVal={}",
                        prjBsc.getId(),guidePcVehValChickFlag,tempGuidePc,tempVehVal);
                if (guidePcVehValChickFlag) {
                    if(Double.valueOf(tempGuidePc).doubleValue() > Double.valueOf(tempVehVal).doubleValue()){
                        throw new BaseException("车辆参考价不能大于车辆估值,产品信息异常");
                    }
                }
                double tempCont = DecimalUtils.convertYuanToFen(DecimalUtils.round(Double.valueOf(tempGuidePc).doubleValue(),0)).doubleValue(); //参考价
                prdBscInfoVO.setGuidePc(tempCont);
                prdBscInfoVO.setPrdAmt(tempCont);
            }

            if (StringUtils.isNotEmpty(prjBsc.getInsCode()) && prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC)){
                PrjCheckResultDTO checkResult = this.projectApiService.getPrjCheckResult(prjBsc.getCstId(), prdBscInfoVO.getSplId());
                if(StringUtils.isEmpty(checkResult.getResultCode())){

                    Map<String, Object> objectMap = checkResult.getRcCstBscInfoMap();
                    if (CollectionUtils.isMapEmpty(objectMap)){
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo("未查询到配偶征信信息");
                        return result;
                    }
                    List<RcCstBscInfoDTO> rcCstBscInfoDTOList = (List<RcCstBscInfoDTO>)objectMap.get("rlRcCstBscInfoList");
                    if (CollectionUtils.isEmpty(rcCstBscInfoDTOList)){
                        result.setSuccess(BaseConstant.IS_YESNO_NO);
                        result.setInfo("未查询到配偶征信信息");
                        return result;
                    }

                    for (RcCstBscInfoDTO rcCstBscInfoDTO : rcCstBscInfoDTOList){
                        if(rcCstBscInfoDTO.getRskLvlCd().equals("3")){
                            result.setSuccess(BaseConstant.IS_YESNO_NO);
                            result.setInfo("配偶征信级别低不支持立项");
                            return result;
                        }
                        rlRcCstId = String.valueOf(rcCstBscInfoDTO.getId());
                    }
                }
            }

            Long id = null;
            if (StringUtils.isNotBlank(prdBaseInfoId)) {
                PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(Long.valueOf(prdBaseInfoId));
                //REQ-12980 如果是修改且前置征信id为空 取原有的
                if(StringUtils.isBlank(rcCstBscInfoId)){
                    rcCstBscInfoId = this.prjLnkCompService.getRrcCstBscInfoId(Long.valueOf(prjId),Long.valueOf(splId));
                }
                /**
                 * 车抵贷线下 二手车交易贷 清空挂靠公司
                 */
                if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                    Long splIdOld = prjPrdBscInfoVO.getSplId();
                    String receiveTypeCdOld = prjPrdBscInfoVO.getReceiveTypeCd();
                    if(splIdOld == null){
                        throw new BaseException("产品信息异常");
                    }
                    /**
                     * 清空挂靠公司
                     */
                    if(StringUtils.isNotEmpty(receiveTypeCdOld) && !(receiveTypeCdOld.equals(receiveTypeCd))){
                        PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
                        prjPrdDtlQc.setPrjId(prjId);
                        List<PrjPrdDtlVO> prjPrdDtlVOS = this.prjPrdDtlService.selectList(prjPrdDtlQc);
                        if(CollectionUtils.isNotEmpty(prjPrdDtlVOS)){
                            List<Long> idlist = new ArrayList<Long>();
                            for (PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOS) {
                                idlist.add(prjPrdDtlVO.getId());
                            }
                            this.prjPrdDtlService.removePrdDtlLnkCompByIds(idlist);
                        }
                    }else{
                        if(!((splIdOld.toString()).equals(splId))){
                            PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
                            prjPrdDtlQc.setPrjId(prjId);
                            List<PrjPrdDtlVO> prjPrdDtlVOS = this.prjPrdDtlService.selectList(prjPrdDtlQc);
                            if(CollectionUtils.isNotEmpty(prjPrdDtlVOS)){
                                List<Long> idlist = new ArrayList<Long>();
                                for (PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOS) {
                                    idlist.add(prjPrdDtlVO.getId());
                                }
                                this.prjPrdDtlService.removePrdDtlLnkCompByIds(idlist);
                            }
                        }
                    }
                }
                // 修改
                prdBscInfoVO.setId(Long.valueOf(prdBaseInfoId));
                prdBscInfoVO.setMdfTm(new Date());
                prdBscInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","修改保存产品项目基础信息入参prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO)
                + ",extDTO=" + JSON.toJSONString(extDTO));
                if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBsc.getPrjTypCd())) {
                    // 查询车型库参配信息主表
                    String businessType = PrjBscInfoConstant.getBusinessTypeMap.get(prjBsc.getBuOrgCd() + prjTypCd);
                    VehSrcInfDTO vehSrcInf = vehSrcInfQueryApiService.selectVehSrcInfByIdAndBusinessType(prdBscInfoVO.getCarSourceId(), businessType);
                    prdBscInfoVO.setStyleId(vehSrcInf.getParaId());  // 车型id
                }
                this.prjBscInfoService.modifyPrjPrdBscAndDetailInfo(prdBscInfoVO, extDTO);
                //如果是重卡、电子合同并且是第一台车，更新非第一台车的推荐经销商信息
                PrjPrdBscInfoQueryCondition prdBscQc = new PrjPrdBscInfoQueryCondition();
                prdBscQc.setPrjId(Long.valueOf(prjId));
                List<PrjPrdBscInfoVO> prjPrdList = this.prjPrdBscInfoService.searchList(prdBscQc);
                if(CollectionUtils.isNotEmpty(prjPrdList)) {
                    //第一台车
                    PrjPrdBscInfoVO prdBscInfo = prjPrdList.get(prjPrdList.size() - 1);
                    if (prjBsc.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC) && prdBscInfo.getRecommendSplId() != null) {
                        if (prdBscInfo.getId().equals(prdBscInfoVO.getId())) {
                            for (PrjPrdBscInfoVO bscInfoVO : prjPrdList) {
                                if(!prdBscInfo.getId().equals(bscInfoVO.getId())){
                                    PrjPrdBscInfoVO tmpBscInfoVO = new PrjPrdBscInfoVO();
                                    tmpBscInfoVO.setId(bscInfoVO.getId());
                                    tmpBscInfoVO.setRecommendSplId(prdBscInfoVO.getRecommendSplId());
                                    tmpBscInfoVO.setRecommendSplNm(prdBscInfoVO.getRecommendSplNm());
                                    this.prjPrdBscInfoService.modify(tmpBscInfoVO);
                                }
                            }
                        }
                    }
                }
                /**
                 * 同步项目产品ID到路由车辆
                 */
                prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(Long.valueOf(prdBaseInfoId));
                if(StringUtils.isNotEmpty(insRoutePrdId)){
                    List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = new ArrayList<PrjPrdBscInfoVO>();
                    prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
                    boolean insFlag = false;
                    if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                        insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                    }else{
                        insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                    }
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
                }else{
                    List<SysDictionaryDTO> sysDictionaryDTOS = this.insRouteBscInfoService.searchRouteCheck();
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","新增车辆信息.资管路由验证sysDictionaryDTOS：" + JSON.toJSONString(sysDictionaryDTOS) + "-prjId:" + prjId,CurrentThreadContext.getCurrentUserName());
                    if(CollectionUtils.isNotEmpty(sysDictionaryDTOS)){
                        for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS){
                            String code = sysDictionaryDTO.getCode();
                            if(StringUtils.isNotBlank(code)){
                                String[] split = code.split("-");
                                if(split.length == 2
                                        &&split[0].equals(prjTypCd)
                                        && split[1].equals(prjBsc.getBuOrgCd())){
                                    /**
                                     * 新增路由车辆数据
                                     */
                                    InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(Long.valueOf(prjId));
                                    List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = new ArrayList<PrjPrdBscInfoVO>();
                                    prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
                                    boolean insFlag = false;
                                    if(insRouteBscInfoVO != null && !(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
                                        insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                                    }else if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                                        insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                                    }
                                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
                                }
                            }
                        }
                    }
                }
                info = "修改成功！";
                result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
            } else {
                // 添加
                prdBscInfoVO.setIsDel(BaseConstant.IS_YESNO_NO);
                prdBscInfoVO.setCrtTm(new Date());
                prdBscInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                prdBscInfoVO.setPrdCd(prdType);
                prdBscInfoVO.setBrCd(brCd);
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","修改保存产品项目基础信息入参prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO)
                + ",extDTO=" + JSON.toJSONString(extDTO));
                if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBsc.getPrjTypCd())){
                    // 查询车型库参配信息主表
                    String businessType = PrjBscInfoConstant.getBusinessTypeMap.get(prjBsc.getBuOrgCd()+prjTypCd);
                    VehSrcInfDTO vehSrcInf = vehSrcInfQueryApiService.selectVehSrcInfByIdAndBusinessType(prdBscInfoVO.getCarSourceId(), businessType);
                    prdBscInfoVO.setStyleId(vehSrcInf.getParaId());  // 车型id
                }
                id = this.prjBscInfoService.addPrjPrdBscAndDetailInfo(prdBscInfoVO, extDTO);
                /**
                 * 同步项目产品ID到路由车辆
                 */
                if(StringUtils.isNotEmpty(insRoutePrdId)){
                    InsRoutePrdInfoVO insRoutePrdInfoVO = new InsRoutePrdInfoVO();
                    insRoutePrdInfoVO.setId(Long.valueOf(insRoutePrdId));
                    insRoutePrdInfoVO.setPrjPrdId(id);
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","同步项目产品ID到路由车辆.insRoutePrdInfoVO:" + JSON.toJSONString(insRoutePrdInfoVO),CurrentThreadContext.getCurrentUserName());
                    this.insRoutePrdInfoService.modify(insRoutePrdInfoVO);
                    PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(id);
                    List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = new ArrayList<PrjPrdBscInfoVO>();
                    prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
                    boolean insFlag = false;
                    if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)
                            || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                        insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                    }else{
                        insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_YES);
                    }
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
                }else{
                    List<SysDictionaryDTO> sysDictionaryDTOS = this.insRouteBscInfoService.searchRouteCheck();
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","新增车辆信息.资管路由验证sysDictionaryDTOS：" + JSON.toJSONString(sysDictionaryDTOS) + "-prjId:" + prjId,CurrentThreadContext.getCurrentUserName());
                    if(CollectionUtils.isNotEmpty(sysDictionaryDTOS)){
                        for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS){
                            String code = sysDictionaryDTO.getCode();
                            if(StringUtils.isNotBlank(code)){
                                String[] split = code.split("-");
                                if(split.length == 2
                                        &&split[0].equals(prjTypCd)
                                        && split[1].equals(prjBsc.getBuOrgCd())){
                                    /**
                                     * 新增路由车辆数据
                                     */
                                    InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(Long.valueOf(prjId));
                                    PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(id);
                                    List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = new ArrayList<PrjPrdBscInfoVO>();
                                    prjPrdBscInfoVOS.add(prjPrdBscInfoVO);
                                    boolean insFlag = false;
                                    if(insRouteBscInfoVO != null && !(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
                                        insFlag = this.insRouteBscInfoService.synchroInsInfo(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_NO);
                                    }else if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)){
                                        insFlag = this.insRouteBscInfoService.synchroInsInfoEsc(prjPrdBscInfoVOS,BaseConstant.IS_YESNO_NO);
                                    }
                                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","同步路由信息.insFlag:" + insFlag,CurrentThreadContext.getCurrentUserName());
                                }
                            }
                        }
                    }
                }
                info = "添加成功！";
                result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
            }

            //REQ-12980 如果选择了挂靠公司 取挂靠公司的征信id
            if(StringUtils.isNotBlank(prdBscInfoVO.getLnkCompId())){
                //查询绑定征信的挂靠公司数据
                DataResultDTO dataResultDTO = this.prjLnkCompService.selectRiskLnkList(prjId, null, splId == null ? null : Long.valueOf(splId));
                List<RcCstChannelInfoDTO> rcCstChannelInfoDTOS = new ArrayList<>();
                if(dataResultDTO != null && dataResultDTO.getData() != null) {
                    rcCstChannelInfoDTOS = (List<RcCstChannelInfoDTO>) (dataResultDTO.getData());
                }
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","挂靠公司id1..." + prdBscInfoVO.getLnkCompId());
                for (RcCstChannelInfoDTO rcCstChannelInfoDTO : rcCstChannelInfoDTOS) {
                    BaseLogUtils.info(logger,"addPrdAndPrdDetail","挂靠公司id2..." + rcCstChannelInfoDTO.getChannelId());
                    if(rcCstChannelInfoDTO.getChannelId().equals(Long.valueOf(prdBscInfoVO.getLnkCompId()))){
                        if(rcCstChannelInfoDTO.getRcCstBscInfoId() != null){
                            rcCstBscInfoId = String.valueOf(rcCstChannelInfoDTO.getRcCstBscInfoId());
                        }
                    }
                }
            }
            if(StringUtils.isNotEmpty(rcCstBscInfoId)){
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","修改征信开始..." + rcCstBscInfoId + prjId);
                boolean b = this.projectApiService.modifyPrjBscRcCstInfo(String.valueOf(prjId), rcCstBscInfoId, "1", rlRcCstId);
                BaseLogUtils.info(logger,"addPrdAndPrdDetail","修改征信结束..." + b);
            }
            result.setData(id);
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("新增项目产品失败,项目id：{}",reqPrjId)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0002);

        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("新增项目产品失败,项目id：{}",reqPrjId)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0002);
        }
        return result;
    }

    /**
     * 换车-新增项目产品
     */
    @RequestMapping(value = "/savePrdAndPrdDetailByHC.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object savePrdAndPrdDetailByHC(HttpServletRequest request, PrjPrdExtVO extDTO) throws BaseException {
        BaseLogUtils.info(logger, "savePrdAndPrdDetailByHC", "savePrdAndPrdDetailByHC新增产品信息入参request=" + this.getRequestParameter(request)
                + ",extDTO=" + JSON.toJSONString(extDTO));
        String reqPrjId = request.getParameter("prjid");
        String prdType = request.getParameter("prdCd");
        String prdBaseInfoId = request.getParameter("prdbscInfoId");
        String brCd = request.getParameter("brCdNm");
        String oldDtlId = request.getParameter("oldDtlId");
        String paySchId = request.getParameter("paySchId");
        String paySchNo = request.getParameter("paySchNo");
        String info = "";
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "新增成功!");
        try {
            if (StringUtils.isEmpty(oldDtlId) || StringUtils.isEmpty(paySchId) || StringUtils.isEmpty(paySchNo)) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("参数不能为空!");
                return result;
            }
            // 项目产品基础信息
            PrjPrdBscInfoVO prdBscInfoVO = getPrdBscInfoRequestParams(request);
            BaseLogUtils.info(logger, "addPrdAndPrdDetail", "返回的产品项目基础信息prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO));
            Long prjId = prdBscInfoVO.getPrjId();
            PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(prjId);
            BaseLogUtils.info(logger, "addPrdAndPrdDetail", "项目id为" + prjId + "项目类型" + prjBsc.getPrjTypCd());
            if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBsc.getPrjTypCd())
                    || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBsc.getPrjTypCd()) || prjBsc.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD)) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("二手车不支持换车！");
                return result;
            }
            Long id = null;
            if (StringUtils.isNotBlank(prdBaseInfoId)) {
                // 修改
                prdBscInfoVO.setId(Long.valueOf(prdBaseInfoId));
                prdBscInfoVO.setMdfTm(new Date());
                prdBscInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                BaseLogUtils.info(logger, "addPrdAndPrdDetail", "修改保存产品项目基础信息入参prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO)
                        + ",extDTO=" + JSON.toJSONString(extDTO));
                this.prjPrdBscInfoService.modifyPrdDetailInfoByHC(prdBscInfoVO, extDTO, Long.valueOf(oldDtlId));
                info = "修改成功！";
                result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
            } else {
                // 添加
                prdBscInfoVO.setIsDel(BaseConstant.IS_YESNO_NO);
                prdBscInfoVO.setCrtTm(new Date());
                prdBscInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
                prdBscInfoVO.setPrdCd(prdType);
                prdBscInfoVO.setBrCd(brCd);
                BaseLogUtils.info(logger, "addPrdAndPrdDetail", "修改保存产品项目基础信息入参prdBscInfoVO=" + JSON.toJSONString(prdBscInfoVO)
                        + ",extDTO=" + JSON.toJSONString(extDTO));
                id = this.prjPrdBscInfoService.addPrdDetailInfoByHC(prdBscInfoVO, extDTO, Long.valueOf(oldDtlId), Long.valueOf(paySchId), paySchNo);
                info = "添加成功！";
                result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
            }
            result.setData(id);
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("新增项目产品失败,项目id：{}", reqPrjId)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0002);

        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("新增项目产品失败,项目id：{}", reqPrjId)
                    .setThrowable(ex)
                    .error(LogExceptionEnum.COMMON_CODE_0002);
        }
        return result;
    }

    private double getCDDContAmt(HttpServletRequest request) {
        double contAmt = 0d;
        String custFina = request.getParameter("custFina");//客户融资额
        String vehVal = request.getParameter("vehVal");//车辆估值
        Map<String,String>  map = this.sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(), DictionaryConstant.CODE_CDD_QUAT_FST_PCT);
        double  maxFstPct = Double.valueOf(map.get("max"))/100;
        double  minFstPct = Double.valueOf(map.get("min"))/100;
        double  firstPct = 0d;//首期比例
        double tempFstPct =  DecimalUtils.round(Double.valueOf(vehVal).doubleValue()*0.8-Double.valueOf(custFina).doubleValue()/Double.valueOf(vehVal).doubleValue()*0.8,2);
        if(tempFstPct>=maxFstPct){
            firstPct = maxFstPct;
        }
        if(tempFstPct<=minFstPct){
            firstPct = minFstPct;
        }
        if(tempFstPct<maxFstPct&&tempFstPct>minFstPct){
            firstPct = tempFstPct;
        }
        contAmt = DecimalUtils.round(DecimalUtils.convertYuanToFen(DecimalUtils.div(Double.valueOf(custFina),(1-firstPct),0)),0) ;
        return contAmt;
    }


    /**
     * 到修改页面(运维专用)
     */
    @RequestMapping(value = "/toModifyPage4Sys.do", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toModifyPage4Sys(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String prdDetailId = request.getParameter("id");
        String prjId = request.getParameter("prjId");
        String detailFlag = request.getParameter("detailFlag");
        String fromCddFlag = request.getParameter("fromCddFlag");//车抵贷标识
        ModelAndView view = new ModelAndView("project/vehicle/projectPrdInfoAdd4Sys");
        view.addObject("fromCddFlag", fromCddFlag);
        //获取项目基础及明细信息
        PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
        if(StringUtils.isNotEmpty(fromCddFlag)){
            BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询产品信息Start=odrPrdId:"+id, CurrentThreadContext.getCurrentUserName());
            OdrPrdBscInfoDTO odrPrdBscInfoDTO = this.odrPrdBscInfoApiService.searchById(Long.valueOf(id));
            BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询产品信息End=odrPrdId:"+id+",odrPrdBscInfoDTO"+JSON.toJSONString(odrPrdBscInfoDTO), CurrentThreadContext.getCurrentUserName());
            prdBscInfoVO.setPrdQty(1);
            prdBscInfoVO.setRsrvPc(100D);
            prdBscInfoVO.setCarStyleName(odrPrdBscInfoDTO.getBrCd()+" "+odrPrdBscInfoDTO.getPrdSeries()+" "+odrPrdBscInfoDTO.getPrdTyp());
            prdBscInfoVO.setModelNm(odrPrdBscInfoDTO.getPrdSeries());
            OdrQuatPrpsQC oqpQC = new OdrQuatPrpsQC();
            oqpQC.setOdrId(Long.valueOf(prjId));
            oqpQC.setIsDel(BaseConstant.IS_YESNO_NO);
            BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询方案信息Start=odrId:"+prjId+",oqpQC:"+JSON.toJSONString(oqpQC), CurrentThreadContext.getCurrentUserName());
            List<OdrQuatPrpsDTO> selectOdrQuatPrpsList = this.odrQuatPrpsApiService.selectOdrQuatPrpsList(oqpQC);
            BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询方案信息End=odrId:"+prjId+",selectOdrQuatPrpsList:"+JSON.toJSONString(selectOdrQuatPrpsList), CurrentThreadContext.getCurrentUserName());

            if(CollectionUtils.isNotEmpty(selectOdrQuatPrpsList)){
                OdrQuatPrpsDTO odrQuatPrpsDTO = selectOdrQuatPrpsList.get(0);
                prdBscInfoVO.setGuidePc(odrQuatPrpsDTO.getContAmt()==null?null:DecimalUtils.convertFenToYuan(odrQuatPrpsDTO.getContAmt()));
            }
        }else{
            prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(Long.valueOf(id));
        }
        List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
        List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();

        PrjBscInfoVO bscVo = new PrjBscInfoVO();
        if(StringUtils.isNotEmpty(fromCddFlag)){
            bscVo.setBuOrgCd(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK);
            bscVo.setPrjTypCd(PrjBscInfoConstant.PRJ_TYP_CD_CDDYW);
        }else{
            bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        }

        Long accId = null;//供应商账号id
        String accNo = "";//供应商账号
        Long backAccId = null;//供应商返利id
        String backAccNo="";// 供应商返利账号
        Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
        Integer hasAccNoFlag = BaseConstant.IS_YESNO_NO;//是否有放款账号
        Long salBackAccId = null;//销售返利id
        String salBackAccNo="";// 销售账号
        Integer hasSalBackNo = BaseConstant.IS_YESNO_NO;
        Integer hasBackNoFlag = BaseConstant.IS_YESNO_NO;//是否已经有了返利账号
        List<Long> accNoIdList = new ArrayList<Long>();
        PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
        accQc.setPrjPrdId(Long.valueOf(id));
        List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
        if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
            for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
                accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
                    accId = prjSplBankAccRVO.getSplAccNoId();
                }
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
                    backAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSplBackNo = BaseConstant.IS_YESNO_YES;
                }
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP)){
                    salBackAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSalBackNo = BaseConstant.IS_YESNO_YES;
                }
            }
        }
        if(CollectionUtils.isNotEmpty(accNoIdList)){
            Pager page = new Pager();
            page.setCurrentPage(1);
            page.setEveryPage(Integer.MAX_VALUE);
            SplBankQueryCondition qc = new SplBankQueryCondition();
            qc.setIdList(accNoIdList);
            page.setCondition(qc);

            Pager pager= 	 this.splBankService.searchListPage(page);
            List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
            if(CollectionUtils.isNotEmpty(list)){
                for (SplBankVO splBankVO : list) {
                    if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
                        accNo = splBankVO.getAccNo();
                    }
                    if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
                        backAccNo = splBankVO.getAccNo();
                    }
                    if(null!=salBackAccId&&splBankVO.getId().equals(salBackAccId.longValue())){
                        salBackAccNo = splBankVO.getAccNo();
                    }
                }
            }
        }

        //查询是否有返利账号，如果有则直接带出不能修改
        PrjPrdBscInfoQueryCondition prdBscQc = new PrjPrdBscInfoQueryCondition();
        prdBscQc.setPrjId(Long.valueOf(prjId));
        List<PrjPrdBscInfoVO> prjPrdList = this.prjPrdBscInfoService.searchList(prdBscQc);
        if(CollectionUtils.isNotEmpty(prjPrdList)){
            //第一台车
            PrjPrdBscInfoVO prdBscInfo = 	prjPrdList.get(prjPrdList.size()-1);
            PrjSplBankAccRQueryCondition backAccQc = new PrjSplBankAccRQueryCondition();
            backAccQc.setPrjPrdId(prdBscInfo.getId());
            List<String> purpCdList = new ArrayList<String>();
            purpCdList.add(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP);
            purpCdList.add(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP);
            backAccQc.setPurpCds(purpCdList);
            List<PrjSplBankAccRVO> splBankAccRList = 	this.prjSplBankAccRService.searchList(backAccQc);
            if(CollectionUtils.isNotEmpty(splBankAccRList)&&!prdBscInfo.getId().equals(Long.valueOf(id))){
                if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)){
                    hasBackNoFlag = BaseConstant.IS_YESNO_YES;
                }
            }

            PrjSplBankAccRQueryCondition splAccQc = new PrjSplBankAccRQueryCondition();
            splAccQc.setPrjPrdId(prdBscInfo.getId());
            splAccQc.setPurpCd(PrjPrdBscInfoConstant.SPL_BANK_NO_TP);
            List<PrjSplBankAccRVO> splAccRVOList = 	this.prjSplBankAccRService.searchList(splAccQc);
            if(CollectionUtils.isNotEmpty(splAccRVOList)&&!prdBscInfo.getId().equals(Long.valueOf(id))){
                if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) &&bscVo.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC)){
                    hasAccNoFlag = BaseConstant.IS_YESNO_YES;//重卡电子合同不可以修改放款账号
                }
            }

            view.addObject("splId", prdBscInfo.getSplId());
            view.addObject("splNm", prdBscInfo.getSplNm());
        }
        //品牌类别
        List<KeyValueVO> brTypCdList  =  this.prjBscInfoService.getBrTypCdList();
        //产品种类
        List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();

        //产品计量单位类型
        List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
        //产品计量单位类型
        List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();

//        SysCdMapDVO plcyMap = this.prjPrdBscInfoService.searchPlcyMapByPrdCd(prdBscInfoVO.getPrdCd());

        view.addObject("id", id);
        view.addObject("prdBscInfoVO", prdBscInfoVO);
        view.addObject("yesNoCdList",yesNoCdList);
        view.addObject("vehCheckCdList",vehCheckCdList);
        view.addObject("modifyFlag",true);
        view.addObject("prdDetailId", prdDetailId);
//        view.addObject("plcyTcode", null==plcyMap?"":plcyMap.getTCode());
        view.addObject("prdUntCdList",prdUntCdList );
        view.addObject("prdCd",  prdBscInfoVO.getPrdCd());
        view.addObject("pCd",  prdBscInfoVO.getPrdCd());
        view.addObject("prdTypCd",  prdBscInfoVO.getPrdTypCd());
        view.addObject("bizTypCd","CVM0001");
        view.addObject("bizCd", bscVo.getBuOrgCd() + prdBscInfoVO.getPrdTypCd());
        view.addObject("prjId", prjId);
        view.addObject("splId", prdBscInfoVO.getSplId());
        view.addObject("splNm", prdBscInfoVO.getSplNm());
        view.addObject("licenseCdList", licenseCdList);
        view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
        view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());

        view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
        view.addObject("detailFlag", detailFlag);
        view.addObject("brTypCdList", brTypCdList);
        view.addObject("prdClsCdList", prdClsCdList);
        view.addObject("buOrgCd", bscVo.getBuOrgCd());
        view.addObject("prjTypCd", bscVo.getPrjTypCd());
        view.addObject("isSplMfr", bscVo.getIsSplMfr());
        view.addObject("insCode", bscVo.getInsCode());
        view.addObject("accId", accId);
        view.addObject("accNo", accNo);
        view.addObject("backAccId", backAccId);
        view.addObject("backAccNo", backAccNo);
        view.addObject("hasSplBackNo", hasSplBackNo);
        view.addObject("salBackAccId", salBackAccId);
        view.addObject("salBackAccNo", salBackAccNo);
        view.addObject("hasSalBackNo", hasSalBackNo);
        view.addObject("hasBackNoFlag", hasBackNoFlag);
        view.addObject("hasAccNoFlag", hasAccNoFlag);
        BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String prdDetailId = request.getParameter("id");
        String prjId = request.getParameter("prjId");
        String detailFlag = request.getParameter("detailFlag");
        String fromCddFlag = request.getParameter("fromCddFlag");//车抵贷标识
        String isDetail = request.getParameter("isDetail");//信审节点标识  1:其他节点 0:信审节点
        ModelAndView view = new ModelAndView("project/vehicle/projectPrdInfoAdd");
        view.addObject("fromCddFlag", fromCddFlag);
        view.addObject("isDetail", isDetail);
        //厂商指导价展示标志
        view.addObject("mfrGuidePcShowFlag", getMfrGuidePcShowFlag(CurrentThreadContext.getCurrentRoleId()));

        //获取项目基础及明细信息
        PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
        if(StringUtils.isNotEmpty(fromCddFlag)){
        	BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询产品信息Start=odrPrdId:"+id, CurrentThreadContext.getCurrentUserName());
        	OdrPrdBscInfoDTO odrPrdBscInfoDTO = this.odrPrdBscInfoApiService.searchById(Long.valueOf(id));
        	BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询产品信息End=odrPrdId:"+id+",odrPrdBscInfoDTO"+JSON.toJSONString(odrPrdBscInfoDTO), CurrentThreadContext.getCurrentUserName());
        	prdBscInfoVO.setPrdQty(1);
        	prdBscInfoVO.setRsrvPc(100D);
        	prdBscInfoVO.setCarStyleName(odrPrdBscInfoDTO.getBrCd()+" "+odrPrdBscInfoDTO.getPrdSeries()+" "+odrPrdBscInfoDTO.getPrdTyp());
        	prdBscInfoVO.setModelNm(odrPrdBscInfoDTO.getPrdSeries());
        	OdrQuatPrpsQC oqpQC = new OdrQuatPrpsQC();
			oqpQC.setOdrId(Long.valueOf(prjId));
			oqpQC.setIsDel(BaseConstant.IS_YESNO_NO);
			BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询方案信息Start=odrId:"+prjId+",oqpQC:"+JSON.toJSONString(oqpQC), CurrentThreadContext.getCurrentUserName());
			List<OdrQuatPrpsDTO> selectOdrQuatPrpsList = this.odrQuatPrpsApiService.selectOdrQuatPrpsList(oqpQC);
			BaseLogUtils.info(logger, "toModifyPage", "=车抵贷-查询方案信息End=odrId:"+prjId+",selectOdrQuatPrpsList:"+JSON.toJSONString(selectOdrQuatPrpsList), CurrentThreadContext.getCurrentUserName());

			if(CollectionUtils.isNotEmpty(selectOdrQuatPrpsList)){
				OdrQuatPrpsDTO odrQuatPrpsDTO = selectOdrQuatPrpsList.get(0);
				prdBscInfoVO.setGuidePc(odrQuatPrpsDTO.getContAmt()==null?null:DecimalUtils.convertFenToYuan(odrQuatPrpsDTO.getContAmt()));
			}
        }else{
        	prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(Long.valueOf(id));
        	PrjPrdDtlQueryCondition prjPrdDtlQueryCondition = new PrjPrdDtlQueryCondition();
        	prjPrdDtlQueryCondition.setPrjPrdId(prdBscInfoVO.getId());
        	PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectOneByCondition(prjPrdDtlQueryCondition);
        	view.addObject("prjPrdDtlVO",prjPrdDtlVO);
        	view.addObject("vehNo",prjPrdDtlVO.getVehNo());
        }
        List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
        List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();

        PrjBscInfoVO bscVo = new PrjBscInfoVO();
        if(StringUtils.isNotEmpty(fromCddFlag)){
        	bscVo.setBuOrgCd(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK);
        	bscVo.setPrjTypCd(PrjBscInfoConstant.PRJ_TYP_CD_CDDYW);
        }else{
        	bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        }

        /**
         * 车辆参考价是否可编辑标志,0-否,1-是
         * 这里要定义车辆参考价是否可编辑规则
         */
        PrjBscInfoDTO prjBscInfoDTO = PrjBscInfoVOTransform.toDTO(bscVo);
        //根据项目ID查看是否关联路由信息
        InsRouteBscInfoVO insRouteBscInfoVO = this.insRouteBscInfoService.searchListByPrjId(prjBscInfoDTO.getId());
        BaseLogUtils.newWebLogger("根据项目ID查看是否关联路由信息 项目ID=" + prjBscInfoDTO.getId() + "路由结果=" + JSON.toJSONString(insRouteBscInfoVO)).info();
        if (insRouteBscInfoVO != null) {
            prjBscInfoDTO.setInsPrjRelateFlag(BaseConstant.IS_YESNO_YES_STR);
        }
        view.addObject("guidePcEditFlag", GuidePcEditUtil.getGuidePcEditFlag(prjBscInfoDTO));

        List<KeyValueVO> keyValueVOList = new ArrayList<KeyValueVO>();
        //车抵贷业务（承租人自然人的情况 收款方类型三种 法人 只有经销商） 非车抵贷业务收款方类型只有经销商  -》返回收款方列表
        String prjTypCd = bscVo.getPrjTypCd();
        Long cstId = bscVo.getCstId();
        CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectById(cstId);
        String cstTypeCd = cstBscInfoVO.getCstTypCd();
        view.addObject("cstTypeCd",cstTypeCd);
        if(StringUtils.isNotBlank(prjTypCd) && prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)){//车抵贷业务
            //判断承租人是否法人
            if(StringUtils.isNotBlank(cstTypeCd) && cstTypeCd.equals(CustomerConstant.CST_TYP_CD_NP)){
                keyValueVOList = this.vehicleStyleService.getReceiveTypeCdList();
            }else{
                KeyValueVO keyValueVO = new KeyValueVO();
                keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
                keyValueVO.setValue("供应商");
                keyValueVOList.add(keyValueVO);
            }
        }else{
            KeyValueVO keyValueVO = new KeyValueVO();
            keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
            keyValueVO.setValue("供应商");
            keyValueVOList.add(keyValueVO);
        }
        view.addObject("receiveTypeCdList",keyValueVOList);
        String receiveTypeCd = prdBscInfoVO.getReceiveTypeCd();
        if(StringUtils.isBlank(receiveTypeCd)){
            receiveTypeCd = CapitalConstant.CODE_PAYEE_TYP_CD_1;
        }
        view.addObject("receiveTypeCd",receiveTypeCd);
        Long accId = null;//供应商账号id
        String accNo = "";//供应商账号
        Long backAccId = null;//供应商返利id
        String backAccNo="";// 供应商返利账号
        Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
        Integer hasAccNoFlag = BaseConstant.IS_YESNO_NO;//是否有放款账号
        Long salBackAccId = null;//销售返利id
        String salBackAccNo="";// 销售账号
        Long compensatoryAccId = null;//代偿担保账号id
        String compensatoryAccNo = "";//代偿担保账号
        String compensatorySplRcptUnt = "";//代偿支付账户
        String compensatorySplBkNm = "";//代偿担保账号开户行
        String compensatorySplBkNo = "";//代偿担保开户行行号

        Long depositAccId = null;//保证金担保账号id
        String depositAccNo = "";//保证金担保账号
        String depositSplRcptUnt = "";//保证金支付账户
        String depositSplBkNm = "";//保证金担保账号开户行
        String depositSplBkNo = "";//保证金担保开户行行号
        Integer hasSalBackNo = BaseConstant.IS_YESNO_NO;
    	Integer hasBackNoFlag = BaseConstant.IS_YESNO_NO;//是否已经有了返利账号
        List<Long> accNoIdList = new ArrayList<Long>();
        PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
        accQc.setPrjPrdId(Long.valueOf(id));
        List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
        if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
            for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
                accNoIdList.add(prjSplBankAccRVO.getSplAccNoId());
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
                    accId = prjSplBankAccRVO.getSplAccNoId();
                }
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
                    backAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSplBackNo = BaseConstant.IS_YESNO_YES;
                }
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP)){
                    salBackAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSalBackNo = BaseConstant.IS_YESNO_YES;
                }
            }
        }
        if(CollectionUtils.isNotEmpty(accNoIdList)){
            Pager page = new Pager();
            page.setCurrentPage(1);
            page.setEveryPage(Integer.MAX_VALUE);
            SplBankQueryCondition qc = new SplBankQueryCondition();
            qc.setIdList(accNoIdList);
            page.setCondition(qc);
            Pager pager= 	 this.splBankService.searchListPage(page);
            List<SplBankVO> list = (List<SplBankVO>) pager.getResultList();
            if(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_2) || receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_8)){
                CstBankVO cstBankVO = this.cstBankService.selectById(accId);
                accNo = cstBankVO.getAccNo();
            }
            if(CollectionUtils.isNotEmpty(list)){
                for (SplBankVO splBankVO : list) {
                    if(!(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_2) || receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_8))){
                        if(null!=accId&&splBankVO.getId().equals(accId.longValue())){
                            accNo = splBankVO.getAccNo();
                        }
                    }
                    if(null!=backAccId&&splBankVO.getId().equals(backAccId.longValue())){
                        backAccNo = splBankVO.getAccNo();
                    }
                    if(null!=salBackAccId&&splBankVO.getId().equals(salBackAccId.longValue())){
                    	salBackAccNo = splBankVO.getAccNo();
                    }
                }
            }
        }

    	//查询是否有返利账号，如果有则直接带出不能修改
		PrjPrdBscInfoQueryCondition prdBscQc = new PrjPrdBscInfoQueryCondition();
		prdBscQc.setPrjId(Long.valueOf(prjId));
		List<PrjPrdBscInfoVO> prjPrdList = this.prjPrdBscInfoService.searchList(prdBscQc);
		//是否可编辑推荐经销商
        view.addObject("isCanEditRecommendSpl", "1");
        view.addObject("recommendSplId", prdBscInfoVO.getRecommendSplId());
        view.addObject("recommendSplNm", prdBscInfoVO.getRecommendSplNm());
        //是否可编辑挂靠公司信息
        view.addObject("isCanEditLnkCompInfo", "1");
        view.addObject("isCanEditCompensatorySplInfo", "1");
        view.addObject("compensatoryType", prjBscInfoDTO.getCompensatoryType() == null ? "0" : prjBscInfoDTO.getCompensatoryType());

        if(CollectionUtils.isNotEmpty(prjPrdList)){
			//第一台车
			PrjPrdBscInfoVO prdBscInfo = 	prjPrdList.get(prjPrdList.size()-1);
            if(bscVo.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC) && prdBscInfo.getRecommendSplId() != null){
                if(!prdBscInfo.getId().equals(prdBscInfoVO.getId())){
                    //如果不是第一辆车 回显第一辆的并且不可编辑
                    view.addObject("recommendSplId", prdBscInfo.getRecommendSplId());
                    view.addObject("recommendSplNm", prdBscInfo.getRecommendSplNm());
                    view.addObject("isCanEditRecommendSpl", "0");
                }
            }
            if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) && (bscVo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CTYW) || bscVo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW))){
                view.addObject("guaranteePaymentType", prdBscInfo.getGuaranteePaymentType());
                view.addObject("guaranteePaymentId", prdBscInfo.getGuaranteePaymentId());
                view.addObject("guaranteePaymentNm", prdBscInfo.getGuaranteePaymentNm());
                if(!prdBscInfo.getId().equals(prdBscInfoVO.getId())){
                    PrjPrdDtlQueryCondition prjPrdDtlQueryCondition = new PrjPrdDtlQueryCondition();
                    prjPrdDtlQueryCondition.setPrjPrdId(prdBscInfo.getId());
                    PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectOneByCondition(prjPrdDtlQueryCondition);
                    view.addObject("prjPrdDtlVO",prjPrdDtlVO);
                    view.addObject("isCanEditLnkCompInfo", "0");
                    view.addObject("isCanEditCompensatorySplInfo", "0");

                }
                //取第一台车的代偿担保账号
                if (CollectionUtils.isNotEmpty(prdBscInfo.getPrjSplBankAccRVOList())) {
                    for (PrjSplBankAccRVO splBankAcc : prdBscInfo.getPrjSplBankAccRVOList()) {
                        //渠道为经销商 取经销商账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP)) {
                            compensatoryAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                            if (null != splBankVO) {
                                compensatoryAccNo = splBankVO.getAccNo();
                                compensatorySplRcptUnt = splBankVO.getRcptUnt();
                                compensatorySplBkNm = splBankVO.getBkNm();
                                compensatorySplBkNo = splBankVO.getBkNo();
                            }
                        }
                        //渠道为挂靠公司 取挂靠公司账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_COMPENSATORY_BANK_NO_TYP)) {
                            compensatoryAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(compensatoryAccId,"11000","0000");
                            if (null != prjLnkCompBkAccDTO) {
                                compensatoryAccNo = prjLnkCompBkAccDTO.getAccNo();
                                compensatorySplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                compensatorySplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                compensatorySplBkNo = prjLnkCompBkAccDTO.getBkNo();
                            }
                        }

                        //渠道为经销商 取经销商账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_DEPOSIT_BANK_NO_TYP)) {
                            depositAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            SplBankVO splBankVO = this.prdSplBankService.selectById(depositAccId);
                            if (null != splBankVO) {
                                depositAccNo = splBankVO.getAccNo();
                                depositSplRcptUnt = splBankVO.getRcptUnt();
                                depositSplBkNm = splBankVO.getBkNm();
                                depositSplBkNo = splBankVO.getBkNo();
                            }
                        }
                        //渠道为挂靠公司 取挂靠公司账号
                        if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfo.getGuaranteePaymentType())&& splBankAcc.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_DEPOSIT_BANK_NO_TYP)) {
                            depositAccId = splBankAcc.getSplAccNoId();//查询供应商账号信息
                            PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                            if (null != prjLnkCompBkAccDTO) {
                                depositAccNo = prjLnkCompBkAccDTO.getAccNo();
                                depositSplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                depositSplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                depositSplBkNo = prjLnkCompBkAccDTO.getBkNo();
                            }
                        }
                    }
                }
            }
            view.addObject("compensatorySplAccNoId", compensatoryAccId);
            view.addObject("compensatorySplAccNoNm", compensatoryAccNo);
            view.addObject("compensatorySplRcptUnt", compensatorySplRcptUnt);
            view.addObject("compensatorySplBkNm", compensatorySplBkNm);
            view.addObject("compensatorySplBkNo", compensatorySplBkNo);

            view.addObject("depositSplAccNoId", depositAccId);
            view.addObject("depositSplAccNoNm", depositAccNo);
            view.addObject("depositSplRcptUnt", depositSplRcptUnt);
            view.addObject("depositSplBkNm", depositSplBkNm);
            view.addObject("depositSplBkNo", depositSplBkNo);

		        PrjSplBankAccRQueryCondition backAccQc = new PrjSplBankAccRQueryCondition();
		        backAccQc.setPrjPrdId(prdBscInfo.getId());
		        List<String> purpCdList = new ArrayList<String>();
		        purpCdList.add(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP);
		        purpCdList.add(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP);
		        backAccQc.setPurpCds(purpCdList);
		        List<PrjSplBankAccRVO> splBankAccRList = 	this.prjSplBankAccRService.searchList(backAccQc);
		        if(CollectionUtils.isNotEmpty(splBankAccRList)&&!prdBscInfo.getId().equals(Long.valueOf(id))){
		        	if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)){
		        		hasBackNoFlag = BaseConstant.IS_YESNO_YES;
		        	}
		        }

		        PrjSplBankAccRQueryCondition splAccQc = new PrjSplBankAccRQueryCondition();
		        splAccQc.setPrjPrdId(prdBscInfo.getId());
		        splAccQc.setPurpCd(PrjPrdBscInfoConstant.SPL_BANK_NO_TP);
		        List<PrjSplBankAccRVO> splAccRVOList = 	this.prjSplBankAccRService.searchList(splAccQc);
		        if(CollectionUtils.isNotEmpty(splAccRVOList)&&!prdBscInfo.getId().equals(Long.valueOf(id))){
	                    if(bscVo.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) &&bscVo.getCntTypCd().equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC)){
	                    	hasAccNoFlag = BaseConstant.IS_YESNO_YES;//重卡电子合同不可以修改放款账号
	                    }
		        }

		        view.addObject("splId", prdBscInfo.getSplId());
	            view.addObject("splNm", prdBscInfo.getSplNm());
		       }
        //品牌类别
        List<KeyValueVO> brTypCdList  =  this.prjBscInfoService.getBrTypCdList();
        //产品种类
        List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();

        //产品计量单位类型
        List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
        //产品计量单位类型
        List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();
        //渠道担保支付主体列表
        List<KeyValueVO> guaranteePaymentTypeList = this.prjBscInfoService.getGuaranteePaymentTypeList();

//        SysCdMapDVO plcyMap = this.prjPrdBscInfoService.searchPlcyMapByPrdCd(prdBscInfoVO.getPrdCd());

        //二手车车辆评估检测报告
        PrjPrdBscInfoVO vo = this.prjPrdBscInfoService.selectById(Long.valueOf(id));
        String pdfFilepath = null;
        if (vo != null && vo.getId() != null){
            PrjPrdSourceInfoVO prjPrdSourceInfoVO = this.prjPrdBscInfoService.selectPrjPrdSourceInfoById(vo.getId());
            if (prjPrdSourceInfoVO != null && prjPrdSourceInfoVO.getPdfFilePath() != null){
                pdfFilepath = PropertiesCacheUtils.getProperty(SysUlFilesRecConstant.SYS_FILE_UPLOAD_SERVER_PATH)+prjPrdSourceInfoVO.getPdfFilePath();
            }
        }
        BaseLogUtils.newWebLogger("==获取车辆检测报告=pdfFilepath:" + pdfFilepath).info();
        view.addObject("pdfFilepath", pdfFilepath);

        view.addObject("id", id);
        view.addObject("prdBscInfoVO", prdBscInfoVO);
        view.addObject("guaranteePaymentTypeList", guaranteePaymentTypeList);
        view.addObject("yesNoCdList",yesNoCdList);
        view.addObject("vehCheckCdList",vehCheckCdList);
        view.addObject("modifyFlag",true);
        view.addObject("prdDetailId", prdDetailId);
//        view.addObject("plcyTcode", null==plcyMap?"":plcyMap.getTCode());
        view.addObject("prdUntCdList",prdUntCdList );
        view.addObject("prdCd",  prdBscInfoVO.getPrdCd());
        view.addObject("pCd",  prdBscInfoVO.getPrdCd());
        view.addObject("prdTypCd",  prdBscInfoVO.getPrdTypCd());
        view.addObject("bizTypCd","CVM0001");
        view.addObject("bizCd", bscVo.getBuOrgCd() + prdBscInfoVO.getPrdTypCd());
        view.addObject("prjId", prjId);
        view.addObject("splId", prdBscInfoVO.getSplId());
        view.addObject("splNm", prdBscInfoVO.getSplNm());

        view.addObject("licenseCdList", licenseCdList);
        view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
        view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());

        view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
        view.addObject("detailFlag", detailFlag);
        view.addObject("brTypCdList", brTypCdList);
        view.addObject("prdClsCdList", prdClsCdList);
        view.addObject("buOrgCd", bscVo.getBuOrgCd());
        view.addObject("prjTypCd", bscVo.getPrjTypCd());
        view.addObject("isSplMfr", bscVo.getIsSplMfr());
        view.addObject("insCode", bscVo.getInsCode());
        view.addObject("accId", accId);
        view.addObject("accNo", accNo);
        view.addObject("backAccId", backAccId);
        view.addObject("backAccNo", backAccNo);
        view.addObject("hasSplBackNo", hasSplBackNo);
        view.addObject("salBackAccId", salBackAccId);
        view.addObject("salBackAccNo", salBackAccNo);
        view.addObject("hasSalBackNo", hasSalBackNo);
        view.addObject("hasBackNoFlag", hasBackNoFlag);
        view.addObject("hasAccNoFlag", hasAccNoFlag);
        view.addObject("styleId", prdBscInfoVO.getStyleId());
        view.addObject("carSourceId", prdBscInfoVO.getCarSourceId());
        //疫情项目收款人和收款账号
        PrjBscInfoVO prjBscInfoVO = prjBscInfoService.selectById(Long.parseLong(prjId));
        BaseLogUtils.info(logger, "toModifyPage", "车抵贷（疫情）查询项目结果prjBscInfoVO=", JSON.toJSONString(prjBscInfoVO));
        view.addObject("", "");
        if (prjBscInfoVO != null && "CDDYWYQ".equals(prjBscInfoVO.getPrjTypCd()) && prjBscInfoVO.getCstId() != null && prjBscInfoVO.getCstNm() != null) {
            if(CustomerConstant.CST_TYP_CD_CORP.equals(cstTypeCd)){
                CstBankQueryCondition cstBankQueryCondition = new CstBankQueryCondition();
                //cstBankQueryCondition.setIsValid(BaseConstant.IS_YESNO_YES);
                cstBankQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
                cstBankQueryCondition.setCstIds(prjBscInfoVO.getCstId().toString());
                BaseLogUtils.info(logger, "toModifyPage", "法人客户银行卡列表.传入参数==>" + JSON.toJSONString(cstBankQueryCondition));
                List<CstBankDTO> cstBankDTOList = this.customerApiService.selectCstBankDetList(cstBankQueryCondition);
                BaseLogUtils.info(logger, "toModifyPage", "法人客户银行卡列表.查询结果==>" + JSON.toJSONString(cstBankDTOList));
                if(CollectionUtils.isEmpty(cstBankDTOList)){
                    throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "车抵贷（疫情）查询银行卡列表失败");
                }
                List<KeyValueVO> yqAccNoList = new ArrayList<>();
                for (CstBankDTO cstBankDTO : cstBankDTOList) {
                    KeyValueVO keyValueVO = new KeyValueVO();
                    keyValueVO.setKey(cstBankDTO.getId().toString());
                    keyValueVO.setValue(cstBankDTO.getAccNo());
                    yqAccNoList.add(keyValueVO);
                }
                BaseLogUtils.info(logger, "toModifyPage", "车抵贷（疫情）银行卡列表结果yqAccNoList=", JSON.toJSONString(yqAccNoList));
                List<PrjBscInfoVO> yqCstIdList = new ArrayList<>();
                yqCstIdList.add(prjBscInfoVO);
                view.addObject("yqCstIdList", yqCstIdList);
                view.addObject("yqAccNoList", yqAccNoList);
            }else{
                List<String> paySchNoList = new ArrayList<>();
                PrjPaySchMYqQC prjPaySchMYqQC = new PrjPaySchMYqQC();
                prjPaySchMYqQC.setPrjId(Long.parseLong(prjId));
                prjPaySchMYqQC.setIsDel(0);
                List<PrjPaySchMYqDTO> prjPaySchMYqDTOS = prjPaySchMYqApiService.searchList(prjPaySchMYqQC);
                BaseLogUtils.newLogger("疫情项目查询结果为prjId=" + prjId + ",prjPaySchMYqDTOS=" + JSON.toJSONString(prjPaySchMYqDTOS)).info();
                if (CollectionUtils.isNotEmpty(prjPaySchMYqDTOS) && prjPaySchMYqDTOS.get(0) != null && prjPaySchMYqDTOS.get(0).getyPrjId() != null) {
                    PrjPrdPaySchMQueryCondition condition = new PrjPrdPaySchMQueryCondition();
                    condition.setPrjId(prjPaySchMYqDTOS.get(0).getyPrjId());
                    condition.setIsDel(0);
                    List<PrjPrdPaySchMVO> prjPrdPaySchMVOS = prjPrdPaySchMService.searchList(condition);
                    BaseLogUtils.newLogger("疫情项目prjPrdPaySchMVOS查询结果为prjId=" + prjPaySchMYqDTOS.get(0).getyPrjId() + ",prjPrdPaySchMVOS=" + JSON.toJSONString(prjPrdPaySchMVOS)).info();
                    if (CollectionUtils.isNotEmpty(prjPrdPaySchMVOS)) {
                        for (PrjPrdPaySchMVO prdPaySchMVO : prjPrdPaySchMVOS) {
                            paySchNoList.add(prdPaySchMVO.getPaySchNo());
                        }
                    }
                }
                DataResultDTO dataResultDTO = carLoanEpidemicApiService.selectBanks(prjBscInfoVO.getCstId().toString(), prjBscInfoVO.getCstNm(), paySchNoList);
                BaseLogUtils.info(logger, "toModifyPage", "车抵贷（疫情）查询银行卡列表dataResultDTO=", JSON.toJSONString(dataResultDTO));
                if (dataResultDTO.getSuccess() == BaseConstant.IS_YESNO_YES) {
                    List<Map<String, String>> mapList = (List<Map<String, String>>)dataResultDTO.getData();
                    List<KeyValueVO> yqAccNoList = new ArrayList<>();
                    for (Map<String, String> maps : mapList) {
                        if ("1".equals(maps.get("isNewPay"))) {
                            view.addObject("yqBankId",  maps.get("bankId") == null ? "" :  maps.get("bankId"));
                            view.addObject("yqAccNo",  maps.get("accNo") == null ? "" :  maps.get("accNo"));
                        }
                        KeyValueVO keyValueVO = new KeyValueVO();
                        keyValueVO.setKey(maps.get("bankId"));
                        keyValueVO.setValue(maps.get("accNo"));
                        yqAccNoList.add(keyValueVO);
                    }
                    BaseLogUtils.info(logger, "toModifyPage", "车抵贷（疫情）银行卡列表结果yqAccNoList=", JSON.toJSONString(yqAccNoList));
                    List<PrjBscInfoVO> yqCstIdList = new ArrayList<>();
                    yqCstIdList.add(prjBscInfoVO);
                    view.addObject("yqCstIdList", yqCstIdList);
                    view.addObject("yqAccNoList", yqAccNoList);
                } else {
                    throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "车抵贷（疫情）查询银行卡列表失败");
                }
            }
        }
        BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
        return view;
    }
    // 卡车信息
    // TODO 回头查字段用，查完就可以删掉了
    private PrjPrdTkInfoVO getPrdTkInfoRequestParams(HttpServletRequest request) {
        PrjPrdTkInfoVO prdTkInfoVO = new PrjPrdTkInfoVO();
        // 卡车-主车
        String drvTyp = request.getParameter("drvTypCd");// 驱动形式
        String engMdl = request.getParameter("engMdl");// 发动机型号
        String hp = request.getParameter("hp");// 马力
        String cabSpec = request.getParameter("cabSpec");// 驾驶室规格
        String grboxMdl = request.getParameter("grboxMdl");// 变速箱型号
        String rearAxleSpec = request.getParameter("rearAxleSpec");// 后桥规格
        String mWhlSpec = request.getParameter("mWhlSpec");// 轮胎规格
        String cntrSz = request.getParameter("cntrSz");// 合格证货箱尺寸

        // 卡车-上装/挂车
        String actCntrSz = request.getParameter("actCntrSz");// 货箱(长*宽*高)
        String thickness = request.getParameter("thickness");// 厚度(底*边)(毫米)
        String axleInfo = request.getParameter("axleInfo");// 车轴品牌*数量
        String matQalCd = request.getParameter("matQalCd");// 板材材质
        String doorInfo = request.getParameter("doorInfo");// 开门数及方式
        String trlWhlSpec = request.getParameter("trlWhlSpec");// 轮胎规格*数量
        String cylSepc = request.getParameter("cylSepc");// 油缸规格
        String othInfo = request.getParameter("othInfo");// 其他
        String tankVol = request.getParameter("tankVol");// 罐体有效容积
        String liftWayCd = request.getParameter("liftWayCd");// 举升方式
        String isHvWhl = request.getParameter("isHvWhl");// 是否有轮胎
        String brTypCd = request.getParameter("brTypCd");// 品牌类别
        String prdClsCd = request.getParameter("prdClsCd");// 产品种类
        String buyWayCd = request.getParameter("buyWayCd");// 保险购买方式

        String emiStd = request.getParameter("emiStd");// 主车-排放标准
        String gasCylSpec = request.getParameter("gasCylSpec");// 主车-燃气瓶规格
        String saddleSpec = request.getParameter("saddleSpec");// 主车-鞍座
        String isHvAirCnd = request.getParameter("isHvAirCnd");// 主车-是否有空调
        String whlBase = request.getParameter("whlBase");// 主车-轴距
        String isHvSub = request.getParameter("isHvSub");// 主车-是否有上装
        String clsExfPc = request.getParameter("clsExfPc");// 主车-底盘出厂价格(元)
        String mOthInfo = request.getParameter("mOthInfo");// 主车其他
        String batDeg = request.getParameter("batDeg");
        String seatRowCd = request.getParameter("seatRowCd");
        String fuelTypCd = request.getParameter("fuelTypCd");

        prdTkInfoVO.setmOthInfo(mOthInfo);
        prdTkInfoVO.setEmiStd(emiStd);
        prdTkInfoVO.setGasCylSpec(gasCylSpec);

        if(StringUtils.isNotBlank(fuelTypCd)){
            prdTkInfoVO.setFuelTypCd(fuelTypCd);
        }
        if(StringUtils.isNotBlank(batDeg)){
            prdTkInfoVO.setBatDeg(Double.valueOf(batDeg));
        }
        if(StringUtils.isNotBlank(seatRowCd)){
            prdTkInfoVO.setSeatRowCd(seatRowCd);
        }

        if (StringUtils.isNotBlank(saddleSpec)) {

            prdTkInfoVO.setSaddleSpec(Long.valueOf(saddleSpec));
        }
        if (StringUtils.isNotBlank(isHvAirCnd)) {

            prdTkInfoVO.setIsHvAirCnd(Integer.valueOf(isHvAirCnd));
        }
        prdTkInfoVO.setWhlBase(whlBase);
        if (StringUtils.isNotBlank(isHvSub)) {
            prdTkInfoVO.setIsHvSub(Integer.valueOf(isHvSub));
        }
        if (StringUtils.isNotBlank(clsExfPc)) {
            prdTkInfoVO.setClsExfPc(Long.valueOf(clsExfPc));
        }
        // 主车
        prdTkInfoVO.setDrvTyp(drvTyp);
        prdTkInfoVO.setEngMdl(engMdl);

        prdTkInfoVO.setBrTypCd(brTypCd);
        prdTkInfoVO.setPrdClsCd(prdClsCd);
        prdTkInfoVO.setBuyWayCd(buyWayCd);
        if (StringUtils.isNotEmpty(tankVol)) {
            prdTkInfoVO.setTankVol(tankVol);
        }
        prdTkInfoVO.setCntrSz(cntrSz);

        if (StringUtils.isNotEmpty(hp)) {
            prdTkInfoVO.setHp(Double.valueOf(hp));
        }
        prdTkInfoVO.setCabSpec(cabSpec);
        prdTkInfoVO.setGrboxMdl(grboxMdl);
        prdTkInfoVO.setRearAxleSpec(rearAxleSpec);
        prdTkInfoVO.setMWhlSpec(mWhlSpec);

        // 上装/挂车
        prdTkInfoVO.setActCntrSz(actCntrSz);
        if (StringUtils.isNotEmpty(thickness)) {
            prdTkInfoVO.setThickness(thickness);
        }
        prdTkInfoVO.setAxleInfo(axleInfo);
        prdTkInfoVO.setMatQalCd(matQalCd);
        prdTkInfoVO.setDoorInfo(doorInfo);
        prdTkInfoVO.setTrlWhlSpec(trlWhlSpec);
        prdTkInfoVO.setCylSepc(cylSepc);
        prdTkInfoVO.setOthInfo(othInfo);
        if (StringUtils.isNotEmpty(tankVol)) {
            prdTkInfoVO.setTankVol(tankVol);
        }
        prdTkInfoVO.setLiftWayCd(liftWayCd);
        if (StringUtils.isNotEmpty(isHvWhl)) {
            prdTkInfoVO.setIsHvWhl(Integer.valueOf(isHvWhl));
        }
        prdTkInfoVO.setCrtTm(new Date());
        prdTkInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        return prdTkInfoVO;
    }

    // 乘用车信息
    // TODO 回头查字段用，查完就可以删掉了
    private PrjPrdCarInfoVO getPrdCarInfoRequestParams(
            HttpServletRequest request) {
        PrjPrdCarInfoVO prdCarInfoVO = new PrjPrdCarInfoVO();
        // 乘用车
        // String prdSeries = request.getParameter("prdSeries");//车辆编码
        String prdYr = request.getParameter("prdYr");// 生产年份
        String prdCyCd = request.getParameter("prdCyCd");// 国别代码
        String outVol = request.getParameter("outVol");// 排量(L)
        String grboxTypCd = request.getParameter("grboxTypCd");// 变速箱类型代码
        String grboxCfg = request.getParameter("grboxCfg");// 变速箱配置
        String seatQtyCd = request.getParameter("seatQtyCd");// 座位
        String engMdl = request.getParameter("engMdl");// 发动机型号
        String drvTypCd = request.getParameter("drvTypCd");// 驱动形式
        String carStrcCd = request.getParameter("carStrcCd");// 车身结构
        String carStrcCfg = request.getParameter("carStrcCfg");// 车身结构配置
        String powerTypCd = request.getParameter("powerTypCd");// 动力方式
        String carCl = request.getParameter("carCl");// 车身颜色
        String carLen = request.getParameter("carLen");// 车身长度(m)
        String maxSpd = request.getParameter("maxSpd");// 最高车速
        String prdWayCd = request.getParameter("prdWayCd");// 生产方式
        String carMdl = request.getParameter("carMdl");// 车型
        String othCfg = request.getParameter("othCfg");// 其他配置
        String prdLvlCd = request.getParameter("prdLvlCd");//
        String emiStdCd = request.getParameter("emiStdCd");
        String maxHp = request.getParameter("maxHp");
        String cylArr = request.getParameter("cylArr");
        String cylNum = request.getParameter("cylNum");
        String gearsNum = request.getParameter("gearsNum");
        String grboxDesc = request.getParameter("grboxDesc");
        String doorNum = request.getParameter("doorNum");
        String inlMdl = request.getParameter("inlMdl");
        String buyWayCd = request.getParameter("buyWayCd");
        String carVol = request.getParameter("carVol");
        String extMil = request.getParameter("extMil");
        String batDeg = request.getParameter("batDeg");

        if(StringUtils.isNotBlank(carVol)){
            prdCarInfoVO.setCarVol(Double.valueOf(carVol));
        }
        if(StringUtils.isNotBlank(extMil)){
            prdCarInfoVO.setExtMil(Double.valueOf(extMil));
        }
        if(StringUtils.isNotBlank(batDeg)){
            prdCarInfoVO.setBatDeg(Double.valueOf(batDeg));
        }

        prdCarInfoVO.setPrdLvlCd(prdLvlCd);

        prdCarInfoVO.setEmiStdCd(emiStdCd);
        prdCarInfoVO.setMaxHp(maxHp);
        prdCarInfoVO.setCylArr(cylArr);
        prdCarInfoVO.setCylNum(cylNum);
        prdCarInfoVO.setGearsNum(gearsNum);
        prdCarInfoVO.setGrboxDesc(grboxDesc);
        prdCarInfoVO.setInlMdl(inlMdl);
        prdCarInfoVO.setBuyWayCd(buyWayCd);
        prdCarInfoVO.setDoorNum(doorNum);

        prdCarInfoVO.setPrdYr(prdYr);
        prdCarInfoVO.setPrdCyCd(prdCyCd);
        prdCarInfoVO.setOutVol(outVol);
        prdCarInfoVO.setGrboxTypCd(grboxTypCd);
        prdCarInfoVO.setGrboxCfg(grboxCfg);
        prdCarInfoVO.setSeatQtyCd(seatQtyCd);
        prdCarInfoVO.setEngMdl(engMdl);
        prdCarInfoVO.setDrvTypCd(drvTypCd);
        prdCarInfoVO.setCarStrcCd(carStrcCd);
        prdCarInfoVO.setCarStrcCfg(carStrcCfg);
        prdCarInfoVO.setPowerTypCd(powerTypCd);
        prdCarInfoVO.setCarCl(carCl);
        if (StringUtils.isNotEmpty(carLen)) {
            prdCarInfoVO.setCarLen(Double.valueOf(carLen));
        }
        if (StringUtils.isNotEmpty(maxSpd)) {
            prdCarInfoVO.setMaxSpd(maxSpd);
        }
        prdCarInfoVO.setPrdWayCd(prdWayCd);
        prdCarInfoVO.setCarMdl(carMdl);
        prdCarInfoVO.setOthCfg(othCfg);
        prdCarInfoVO.setCrtTm(new Date());
        prdCarInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        return prdCarInfoVO;
    }

    // 项目基础信息
    private PrjPrdBscInfoVO getPrdBscInfoRequestParams(HttpServletRequest request)throws BaseException {
        PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
        List<PrjSplBankAccRVO> bankAccList = new ArrayList<PrjSplBankAccRVO>();
        String prdBaseInfoId = request.getParameter("prdbscInfoId");//ID
        String prdTypCd = request.getParameter("prdTypCd");// 产品类型
        String mfrId = request.getParameter("mfrId");// 厂商ID
        String styleId = request.getParameter("styleId");// 厂商ID
        String mfrNm = request.getParameter("mfrNm");// 厂商名称
        String brCd = request.getParameter("brCdNm");// 品牌代码
        String prdNm = request.getParameter("prdNm");// 产品名称
        String prdMdl = request.getParameter("prdMdl");// 产品型号
        String guidePc = request.getParameter("guidePc");// 产品指导价
        String prdRem = request.getParameter("prdRem");// 备注
        String prdCd = request.getParameter("prdCd");// 产品代码
        String prjId = request.getParameter("prjId");// 项目id
        String prdId = request.getParameter("prdId");// 产品Id；
        String isNew = request.getParameter("isNew");// 是否为新品
        String usedPd = request.getParameter("usedPd");// 使用期限
        String secUsedPd = request.getParameter("secUsedPd");// 产品已使用期限
        String rsrvPc = request.getParameter("rsrvPc");// 产品留购价
        String prdQty = request.getParameter("prdQty");// 产品数量
        // String prdUntCd = request.getParameter("prdUntCd");//计量单位
        String prdAmt = request.getParameter("prdAmt");// 产品金额
        String splId = request.getParameter("splId");// 供应商ID
        String splNm = request.getParameter("splNm");// 供应商名称
        String recommendSplId = request.getParameter("recommendSplId");//推荐经销商id
        String recommendSplNm = request.getParameter("recommendSplNm");//推荐经销商名称
        String cstSplId = request.getParameter("cstSplId");//承租人、担保人ID
        String cstSplNm = request.getParameter("cstSplNm");// 承租人、担保人ID
        String certDt = request.getParameter("certDt");// 登记证书日期
        String invAmt = request.getParameter("invAmt");// 发票金额(元)
        String irrPct = request.getParameter("irrPct");// 实际收益
        String prdDtlId = request.getParameter("prdDtlId");// 产品详细ID
        String removeFlag = request.getParameter("removeFlag");// 是否删除支付表、产品明细等信息
        String deprRate = request.getParameter("deprRate");// 折旧率
        String deprAmt = request.getParameter("deprAmt");// 折旧金额
        String splAccNoId = request.getParameter("splAccNoId");// 供应商账号
        String bankAccNoList = request.getParameter("bankAccNoList");
        String splMfrId  = request.getParameter("splMfrId");
        String splMfrNm  = request.getParameter("splMfrNm");
        String mOthInfo = request.getParameter("mOthInfo");
        String  licenseCd = request.getParameter("licenseCd");
        String  carStyleName = request.getParameter("carStyleName");
        String  modelNm = request.getParameter("modelNm");
        String receiveTypeCd = request.getParameter("receiveTypeCd");
        String vehVal = request.getParameter("vehVal");//车辆估值
        String custFina = request.getParameter("custFina");//客户融资额
        String vehCheckCode = request.getParameter("vehCheckCode");//验车方式
        String carSourceId = request.getParameter("carSourceId");//车源id
        String isDetail = request.getParameter("isDetail");//信审节点标识  1:其他节点 0:信审节点
        String yqCstSplId = request.getParameter("yqCstSplId");//疫情项目客户id
        String yqSplAccNoId = request.getParameter("yqSplAccNoId");//疫情项目账号
        String isAdvLic = request.getParameter("isAdvLic");
        String advLicTm = request.getParameter("advLicTm");
        String lnkCompNm = request.getParameter("lnkCompNm");
        String lnkCompId = request.getParameter("lnkCompId");
        String lnkCompType = request.getParameter("lnkCompType");
        String lnkCompMsg = request.getParameter("lnkCompMsg");
        String lnkStartLvl = request.getParameter("lnkStartLvl");
        String guaranteePaymentType = request.getParameter("guaranteePaymentType");
        String guaranteePaymentId = request.getParameter("guaranteePaymentId");
        String guaranteePaymentNm = request.getParameter("guaranteePaymentNm");
        PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        if(StringUtils.isEmpty(prdNm)){
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"产品名称不能为空.");
        }
        if(StringUtils.isEmpty(brCd)){
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"产品品牌不能为空.");
        }
        String prjTypCd = prjBscInfoVO.getPrjTypCd();
        String buOrgCd = prjBscInfoVO.getBuOrgCd();
        if(prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)
                &&((prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW) && (prjBscInfoVO.getIsSplMfr() == 1L)) || (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CTYW) && (prjBscInfoVO.getIsSplMfr() == 1L)))
                &&StringUtils.isBlank(splMfrId)
                ){
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请选择供应商厂商信息");
        }
	/*	if(prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)
				&&(null!=prjBscInfoVO.getInsCode()&&prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC))
				&&StringUtils.isBlank(mOthInfo)
				){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请按照要求填写备注信息！");
		}*/
        //推荐经销商取消必填限制
        /*if(prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) && StringUtils.isBlank(recommendSplId)){
            //二手车交易贷、车抵贷线下、内转交易贷非强制校验推荐经销商
            if(!PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBscInfoVO.getPrjTypCd())
                    && !PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBscInfoVO.getPrjTypCd())
                    && !PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBscInfoVO.getPrjTypCd())){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请选择推荐经销商！");
            }
        }*/
	    if(StringUtils.isNotBlank(carSourceId)){
            prdBscInfoVO.setCarSourceId(Long.valueOf(carSourceId));
        }
        if(StringUtils.isNotBlank(recommendSplId)){
            prdBscInfoVO.setRecommendSplId(Long.valueOf(recommendSplId));
        }
        if(StringUtils.isNotBlank(recommendSplNm)){
            prdBscInfoVO.setRecommendSplNm(recommendSplNm);
        }
        if(StringUtils.isNotBlank(guaranteePaymentType)){
            prdBscInfoVO.setGuaranteePaymentType(guaranteePaymentType);
        }
        if(StringUtils.isNotBlank(guaranteePaymentId)){
            prdBscInfoVO.setGuaranteePaymentId(Long.valueOf(guaranteePaymentId));
        }
        if(StringUtils.isNotBlank(guaranteePaymentNm)){
            prdBscInfoVO.setGuaranteePaymentNm(guaranteePaymentNm);
        }
        //REQ-12980 如果挂靠公司类型选了公户 挂靠公司必选
        if(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(prjBscInfoVO.getBuOrgCd())
                && (PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjTypCd))){
            if("1".equals(lnkCompType) && StringUtils.isBlank(lnkCompId)){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请选择挂靠公司！");
            }
        }
        //REQ-12980增加挂靠公司相关字段
        if(StringUtils.isNotBlank(lnkCompNm)){
            prdBscInfoVO.setLnkCompNm(lnkCompNm);
        }
        if(StringUtils.isNotBlank(lnkCompId)){
            prdBscInfoVO.setLnkCompId(lnkCompId);
        }
        if(StringUtils.isNotBlank(lnkCompType)){
            prdBscInfoVO.setLnkCompType(lnkCompType);
        }
        if(StringUtils.isNotBlank(lnkCompMsg)){
            prdBscInfoVO.setLnkCompMsg(lnkCompMsg);
        }
        if(StringUtils.isNotBlank(lnkStartLvl)){
            prdBscInfoVO.setLnkStartLvl(Long.valueOf(lnkStartLvl));
        }
        if(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(buOrgCd)
                && (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd)
                || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd)
                || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))){
            if(StringUtils.isBlank(prdQty)){
                throw new BaseException("设备数量不能为空");
            }
            int count = 0;
            PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
            qc.setPrjId(Long.valueOf(prjId));
            List<PrjPrdBscInfoVO> prjPrdBscInfoVOS = this.prjPrdBscInfoService.searchList(qc);
            if(CollectionUtils.isNotEmpty(prjPrdBscInfoVOS)){
                if(StringUtils.isNotBlank(prdBaseInfoId)){
                    for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOS) {
                        if(StringUtils.isNotBlank(prdBaseInfoId) && (Long.valueOf(prdBaseInfoId)).equals(prjPrdBscInfoVO.getId())){
                            count += (Long.valueOf(prdQty)-prjPrdBscInfoVO.getPrdQty());
                        }else{
                            count +=  prjPrdBscInfoVO.getPrdQty();
                        }
                    }
                    if(count > 10){
                        throw new BaseException("本业务最多允许新增10台车辆");
                    }
                }else{
                    for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOS) {
                        count += prjPrdBscInfoVO.getPrdQty();
                    }
                    count += Long.valueOf(prdQty);
                    if(count > 10){
                        throw new BaseException("本业务最多允许新增10台车辆");
                    }
                }
            }else{
                if(Long.valueOf(prdQty) > 10){
                    throw new BaseException("本业务最多允许新增10台车辆");
                }
            }
        }
	    if((prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)|| prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd))&&prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)){
            /*if(StringUtils.isBlank(vehVal)){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请填写车辆估值信息信息！");
            }*/
            if(prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL) && StringUtils.isBlank(custFina)){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请填写客户融资额信息！");
            }
            if (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)) {
                if(StringUtils.isNotEmpty(prjBscInfoVO.getInsCode())){
                    /**
                     * 资管业务 有要用客户融资金额倒推的 客户融资金额不能为空
                     */
                    if(prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_JXFL)
                            || prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_XYFL)
                            || prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_SYFL)
                    ){
                        if(StringUtils.isBlank(custFina)){
                            BaseLogUtils.newLogger("资管二手车交易贷客户融资金额为空，项目id：{} ，客户融资金额：{}，车辆估值：{}"
                                    ,prjId,custFina,vehVal).info();
                            throw new BaseException("资管二手车交易贷资管业务-请填写客户融资额信息！");
                        }
                        if(StringUtils.isNotBlank(custFina) && ( "0".equals(custFina)  || "0.0".equals(custFina) )){
                            BaseLogUtils.newLogger("资管二手车交易贷业务车客户融资金额为0，项目id：{} ，客户融资金额：{}，车辆估值：{}"
                                    ,prjId,custFina,vehVal).info();
                            throw new BaseException("资管二手车交易贷业务车客户融资金额为0");
                        }
                    }

                }
            }
            if (prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)) {
                if(StringUtils.isNotEmpty(prjBscInfoVO.getInsCode())){
                    /**
                     * 资管业务 有要用客户融资金额倒推的 客户融资金额不能为空
                     */
                    if(prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_JXFL)
                            || prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_XYFL)
                            || prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_SYFL)
                    ){
                        if(StringUtils.isBlank(custFina)){
                            BaseLogUtils.newLogger("资管二手车客户融资金额为空，项目id：{} ，客户融资金额：{}，车辆估值：{}"
                                    ,prjId,custFina,vehVal).info();
                            throw new BaseException("资管二手车资管业务-请填写客户融资额信息！");
                        }
                        if(StringUtils.isNotBlank(custFina) && ( "0".equals(custFina)  || "0.0".equals(custFina) )){
                            BaseLogUtils.newLogger("资管车抵贷线下业务车客户融资金额为0，项目id：{} ，客户融资金额：{}，车辆估值：{}"
                                    ,prjId,custFina,vehVal).info();
                            throw new BaseException("资管车抵贷线下业务车客户融资金额为0");
                        }
                    }

                }else{
                    /**
                     * 我司业务 客户融资金额不能为空
                     */
                    if(StringUtils.isBlank(custFina)){
                        throw new BaseException("我司业务车抵贷线下业务-请填写客户融资额信息！");
                    }
                    if(StringUtils.isNotBlank(custFina) && ( "0".equals(custFina)  || "0.0".equals(custFina) )){
                        BaseLogUtils.newLogger("我司业务车抵贷线下业务车客户融资金额为0，项目id：{} ，客户融资金额：{}，车辆估值：{}"
                                ,prjId,custFina,vehVal).info();
                        throw new BaseException("我司业务车抵贷线下业务车客户融资金额为0");
                    }
                }
            }
            /**
             * 校验后如果客户融资金额为空  默认为 0
             */
            if(StringUtils.isBlank(custFina)){
                custFina = "0";
            }
        }
        if(StringUtils.isBlank(isDetail) ||  isDetail != "0"){
            if(StringUtils.isNotBlank(vehVal)){
                prdBscInfoVO.setVehVal(DecimalUtils.convertYuanToFen(Double.valueOf(vehVal)).doubleValue());
            }
            if (StringUtils.isNotEmpty(vehCheckCode)) {
                prdBscInfoVO.setVehCheckCode(vehCheckCode);
            }
        }
        if(StringUtils.isNotBlank(custFina)){
            prdBscInfoVO.setCustFina(DecimalUtils.convertYuanToFen(Double.valueOf(custFina)).doubleValue());
        }
        if(StringUtils.isNotBlank(licenseCd)){
            prdBscInfoVO.setLicenseCd(licenseCd);
        }
        if(StringUtils.isNotBlank(splMfrId)){
            prdBscInfoVO.setSplMfrId(Long.valueOf(splMfrId));
        }

        if(StringUtils.isNotBlank(splMfrNm)){
            prdBscInfoVO.setSplMfrNm(splMfrNm);
        }
        if ("CDDYWYQ".equals(prjTypCd)) {
            prdBscInfoVO.setSplAccNoId(Long.valueOf(yqSplAccNoId));
            prdBscInfoVO.setSplId(Long.parseLong(yqCstSplId));
        } else {
            if (StringUtils.isNotBlank(splAccNoId)) {
                prdBscInfoVO.setSplAccNoId(Long.valueOf(splAccNoId));
            }
            if(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_1)){//经销商
                if (StringUtils.isNotEmpty(splId)) {
                    prdBscInfoVO.setSplId(Long.parseLong(splId));
                }
                prdBscInfoVO.setSplNm(splNm);
            }else{//承租人、担保人
                if (StringUtils.isNotEmpty(cstSplId)) {
                    prdBscInfoVO.setSplId(Long.parseLong(cstSplId));
                }
                prdBscInfoVO.setSplNm(cstSplNm);
            }
        }
        if (StringUtils.isNotBlank(deprRate)) {
            prdBscInfoVO.setDeprRate(Double.valueOf(deprRate));
        }
        if (StringUtils.isNotBlank(deprAmt)) {
            prdBscInfoVO.setDeprAmt(Double.valueOf(deprAmt));
        }
        if (StringUtils.isNotBlank(irrPct)) {
            prdBscInfoVO.setIrrPct(Double.valueOf(irrPct));
        }
        if (StringUtils.isNotBlank(certDt)) {
            prdBscInfoVO.setCertDt(DateUtils.formatStringToDate(certDt,
                    DateUtils.YYYY_MM_DD));
        }
        if(StringUtils.isNotBlank(styleId)){
            prdBscInfoVO.setStyleId(Long.parseLong(styleId));
        }
        if(StringUtils.isBlank(receiveTypeCd)){
            receiveTypeCd = CapitalConstant.CODE_PAYEE_TYP_CD_1;
        }
        prdBscInfoVO.setReceiveTypeCd(receiveTypeCd);

        if(!PrjBscInfoConstant.COMPENSATORY_TYPE_0.equals(prjBscInfoVO.getCompensatoryType())){
            if(StringUtils.isBlank(guaranteePaymentId) || StringUtils.isBlank(guaranteePaymentNm)){
                throw new BaseException("请选择担保主体！");
            }
        }
        List<PrjSplBankAccRVO> list = new ArrayList<PrjSplBankAccRVO>();
        boolean isHaveCompensatorySplAccNo = false;
        boolean isHaveDepositSplAccNo = false;
        if(StringUtils.isNotBlank(bankAccNoList)){
            bankAccList = JSON.parseArray(bankAccNoList, PrjSplBankAccRVO.class);
            for (PrjSplBankAccRVO prjSplBankAccRVO : bankAccList) {
                prjSplBankAccRVO.setReceiveTypeCd(receiveTypeCd);
                if(null!=prjSplBankAccRVO.getSplAccNoId()){
                    list.add(prjSplBankAccRVO);
                    if(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd()) || PrjPrdBscInfoConstant.LNKCOMP_COMPENSATORY_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd())){
                        isHaveCompensatorySplAccNo = true;
                    }
                    if(PrjPrdBscInfoConstant.SPL_DEPOSIT_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd()) || PrjPrdBscInfoConstant.LNKCOMP_DEPOSIT_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd())){
                        isHaveDepositSplAccNo = true;
                    }
                }
            }
        }
        if(PrjBscInfoConstant.COMPENSATORY_TYPE_1.equals(prjBscInfoVO.getCompensatoryType()) && !isHaveCompensatorySplAccNo){
            throw new BaseException("请选择代偿担保支付账号！");
        }
        if(PrjBscInfoConstant.COMPENSATORY_TYPE_2.equals(prjBscInfoVO.getCompensatoryType()) && !isHaveDepositSplAccNo){
            throw new BaseException("请选择保证金担保支付账号！");
        }
        prdBscInfoVO.setPrjSplBankAccRVOList(list);
        if (StringUtils.isNotBlank(invAmt)) {
            prdBscInfoVO
                    .setInvAmt(DecimalUtils.mul(Double.valueOf(invAmt), 100));
        }
        prdBscInfoVO.setRemoveFlag(removeFlag);
        prdBscInfoVO.setPrdTypCd(prdTypCd);
        if (StringUtils.isNotEmpty(mfrId)) {
            prdBscInfoVO.setMfrId(Long.valueOf(mfrId));
        }
        prdBscInfoVO.setMfrNm(mfrNm);
        prdBscInfoVO.setBrCd(brCd);

        if (StringUtils.isNotEmpty(prdDtlId)) {
            prdBscInfoVO.setPrdDtlId(Long.valueOf(prdDtlId));
        }
        if (StringUtils.isNotEmpty(prjId)) {
            prdBscInfoVO.setPrjId(Long.valueOf(prjId));
        }
        if (StringUtils.isNotEmpty(prdId)) {
            prdBscInfoVO.setPrdId(Long.valueOf(prdId));
        }
        if (StringUtils.isNotEmpty(isNew)) {
            prdBscInfoVO.setIsNew(Integer.parseInt(isNew));
        }
        if (StringUtils.isNotEmpty(usedPd)) {
            prdBscInfoVO.setUsedPd(Integer.valueOf(usedPd));
        } else {
            if (StringUtils.isNotEmpty(secUsedPd)) {
                prdBscInfoVO.setUsedPd(Integer.valueOf(secUsedPd));
            }
        }
        if (StringUtils.isNotEmpty(rsrvPc)) {
            prdBscInfoVO.setRsrvPc(DecimalUtils.mul(Long.valueOf(rsrvPc), 100));
        }
        if(StringUtils.isNotEmpty(carStyleName)){
            prdBscInfoVO.setCarStyleName(carStyleName);
        }
        if(StringUtils.isNotEmpty(modelNm)){
            prdBscInfoVO.setModelNm(modelNm);
        }
        if (StringUtils.isNotEmpty(prdQty)) {
            prdBscInfoVO.setPrdQty(Integer.parseInt(prdQty));
            if(prdBscInfoVO.getPrdQty()> PrjPrdBscInfoConstant.PRJ_PRD_MAX_QTY){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"产品的数量最多为："+PrjPrdBscInfoConstant.PRJ_PRD_MAX_QTY);
            }
        }
        /*
         * if(StringUtils.isNotEmpty(prdUntCd)){
         * prdBscInfoVO.setPrdUntCd(prdUntCd); }
         */
        if (StringUtils.isNotEmpty(guidePc)) {
            prdBscInfoVO.setGuidePc(DecimalUtils.mul(Double.valueOf(guidePc),
                    100));
        }
        if (StringUtils.isNotEmpty(guidePc) && StringUtils.isNotEmpty(prdQty)) {
            prdBscInfoVO.setPrdAmt(DecimalUtils.mul(prdBscInfoVO.getGuidePc(),
                    Double.valueOf(prdQty)));
        }
        if(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_1)){//经销商
            if (StringUtils.isNotEmpty(splId)) {
                prdBscInfoVO.setSplId(Long.parseLong(splId));
            }
            prdBscInfoVO.setSplNm(splNm);
        }else{//承租人、担保人
            if (StringUtils.isNotEmpty(cstSplId)) {
                prdBscInfoVO.setSplId(Long.parseLong(cstSplId));
            }
            prdBscInfoVO.setSplNm(cstSplNm);
        }
        prdBscInfoVO.setPrdNm(prdNm.trim());
        if(StringUtils.isNotBlank(prdMdl)){
            prdBscInfoVO.setPrdMdl(prdMdl.trim());
        }
        if (PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(prjBscInfoVO.getBuOrgCd()) && prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW)){
            if (StringUtils.isNotBlank(isAdvLic)){
                prdBscInfoVO.setIsAdvLic(Integer.parseInt(isAdvLic));
            }
            if ("1".equals(isAdvLic) && StringUtils.isNotBlank(advLicTm)){//预上牌=是
                prdBscInfoVO.setAdvLicTm(DateUtils.formatStringToDate(advLicTm, DateUtils.YYYY_MM_DD));
            }
        }
        prdBscInfoVO.setPrdRem(prdRem);
        prdBscInfoVO.setPrdCd(prdCd);
        prdBscInfoVO.setPrdTypCd(prdTypCd);
        return prdBscInfoVO;
    }


    @RequestMapping("getPrjPrdBscInfoAndExtById.do")
    @ResponseBody
    public PrjPrdBscInfoVO getPrjPrdBscInfoAndExtById(String id){
        PrjPrdBscInfoVO res = this.vehicleStyleService.getPrjPrdBscnInfoAndExtById(id);
        //通过车型ID获取厂商指导价,展示在页面上
        if (res.getStyleId() != null) {
            // 查询车型库信息
            VechileStyleDTO vechileStyleDTO = styleApiService.selectById(res.getStyleId());
            BaseLogUtils.newLogger("getPrjPrdBscInfoAndExtById 通过车型ID获取车辆信息 车型ID={},车辆信息={}"
                ,res.getStyleId(),JSON.toJSONString(vechileStyleDTO)).info();
            if (vechileStyleDTO != null && vechileStyleDTO.getStyleMsrp() != null) {
                res.setMfrGuidePc(vechileStyleDTO.getStyleMsrp() * 10000);
            }
            BaseLogUtils.newLogger("getPrjPrdBscInfoAndExtById 通过车型ID获取车辆信息 车型ID={},车辆信息={},产品信息res={}"
                    ,res.getStyleId(),JSON.toJSONString(vechileStyleDTO),JSON.toJSONString(res)).info();
        }
        return res;
    }
    /**
     *
     * @param id 车型id
     * @return
     */
    @RequestMapping("carDetail.do")
    @ResponseBody
    public PrjPrdParamConfigVO carDetail(Long id){
        // 查询车型具体参数信息
        PrjPrdParamConfigVO prdDetail = this.vehicleStyleService.getPrdDetail(id);
        return prdDetail;
    }

    /**
     * 品牌下拉数据
     * @return
     */
    @RequestMapping("brand.do")
    @ResponseBody
    public List<KeyValueVO> brand(){
        List<KeyValueVO> comboBoxeList = vehicleStyleService.getBrandList();
        return comboBoxeList;
    }

    /**
     * 车系下拉数据
     * @return
     */
    @RequestMapping("carModel.do")
    @ResponseBody
    public List<KeyValueVO> carModel(Long brandId){
        List<KeyValueVO> modelList = vehicleStyleService.getModelList(brandId);
        return modelList;
    }

    /**
     *  车型下拉数据
     * @param brandId 品牌id
     * @return
     */
    @RequestMapping("carStyle.do")
    @ResponseBody
    public List<KeyValueVO> carStyle(Long brandId,Long carModelId,Long purpose){
        List<KeyValueVO> styleList = vehicleStyleService.getStyleList(brandId,carModelId,purpose);
        return styleList;
    }

    /**
     * 车辆用途2级
     * @Param lv1 一级代码
     * @return
     */
    @RequestMapping("carUsage.do")
    @ResponseBody
    public List<KeyValueVO> carUsage(String lv1 ,String modelId){
        List<KeyValueVO> carUsageList =vehicleStyleService.getCarUsageLv2(modelId,lv1);
        return carUsageList;
    }
    /**
     * 车辆用途1级
     * @param modelId 车系id
     * @return
     */
    @RequestMapping("carUsageLv1.do")
    @ResponseBody
    public List<KeyValueVO> carUsageLv1(Long modelId){
        // 只查车系下的 车分类
        List<KeyValueVO> carUsageLv1 = vehicleStyleService.getCarUsageLv1(modelId);
        return carUsageLv1;
    }

    /**
     * 同步保存车源信息
     */
    @RequestMapping(value = "/addPrdCarSourceDetail.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object addPrdCarSourceDetail(HttpServletRequest request,PrjPrdExtVO extDTO) throws BaseException {
        BaseLogUtils.info(logger,"addPrdAndPrdDetail","addPrdCarSourceDetail同步保存车源信息入参request=" + this.getRequestParameter(request)
            + ",extDTO=" + JSON.toJSONString(extDTO));
        String prdBaseInfoId = request.getParameter("prdbscInfoId");
        String prjId = request.getParameter("prjId");// 项目id
        String info = "";
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
                "同步成功!");
        try {
            if (StringUtils.isNotBlank(prdBaseInfoId)) {
                // 修改
                PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
                prdBscInfoVO.setId(Long.valueOf(prdBaseInfoId));
                prdBscInfoVO.setPrjId(Long.valueOf(prjId));
                prdBscInfoVO.setMdfTm(new Date());
                prdBscInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                this.prjBscInfoService.modifyPrjPrdCarSourceDetailInfo(prdBscInfoVO,extDTO);
                info = "同步成功！";
                result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            logger.error(ex.getMessage(), ex);
            BaseLogUtils.info(logger, "addPrdCarSourceDetail",
                    "ERROR" + ex.getMessage());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.error(logger, "addPrdCarSourceDetail",
                    "ERROR" + ex.getMessage());
        }
        return result;
    }

    /**
     *
     * @param
     * @return
     */
    @RequestMapping("toPdfFilepath.do")
    @ResponseBody
    public String pdfFilepath(Long id){
        PrjPrdBscInfoVO vo = this.prjPrdBscInfoService.selectById(Long.valueOf(id));
        String pdfFilepath = null;
        if (vo != null && vo.getCarSourceId() != null){
            // 查询车型库参配信息主表
            VehSrcInfDTO vehSrcInf = vehSrcInfQueryApiService.selectVehSrcInfDTOById(vo.getCarSourceId());
            if (vehSrcInf != null && vehSrcInf.getPdfFilepath() != null){
                pdfFilepath = PropertiesCacheUtils.getProperty(SysUlFilesRecConstant.SYS_FILE_UPLOAD_SERVER_PATH)+vehSrcInf.getPdfFilepath();
            }
        }
        return pdfFilepath;
    }

    /**
     * 根据车源编号检查该项目是否已经添加过已有的车源编号
     */
    @RequestMapping(value = "/getCheckPrjPrdBscInfo.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getExistComp(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        String carNo = request.getParameter("carNo");//车源编号

        if(StringUtils.isEmpty(carNo)){
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.newLogger("getCheckPrjPrdBscInfo 校验项目产品信息是否已存在失败,车源编号为空！carNo:{}", carNo).setLogOperType(LogOperEnum.REQ).setBussinessId(BusinessIdConstant.LOG_SCH_MANAGER_CD).setWarning(false).info();
            return result;
        }
        boolean flag = false;
        try {
            PrjPrdBscInfoQueryCondition prdBscQc = new PrjPrdBscInfoQueryCondition();
            prdBscQc.setCarNo(carNo);
            flag = this.prjPrdBscInfoService.checkPrjPrdCarNoExist(prdBscQc);
            if(flag){
                result.setInfo("1");
                BaseLogUtils.newLogger("getCheckPrjPrdBscInfo 已有该车源编号项目产品数据！carNo:{}", carNo).setLogOperType(LogOperEnum.REQ).setBussinessId(BusinessIdConstant.LOG_SCH_MANAGER_CD).setWarning(false).info();
            }else{
                result.setInfo("0");
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            BaseLogUtils.newLogger("getCheckPrjPrdBscInfo 操作失败！,carNo:{},ex:{}", carNo, ex.getMessage()).setLogOperType(LogOperEnum.REQ).setBussinessId(BusinessIdConstant.LOG_SCH_MANAGER_CD).setWarning(false).info();
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.newLogger("操作失败！,carNo:{},ex:{}", carNo, ex.getMessage()).setThrowable(ex).error(LogExceptionEnum.COMMON_CODE_0002);
        }
        return result;
    }

    /**
     * 到产品详细信息页面
     * @Param prjId 项目id
     * @Param id 车型styleId
     * @param purposeCd 用途代码
     */
    @RequestMapping(value = "/toPrjPrdDetailPageByHC.do", method = {RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toPrjPrdDetailPageByHC(HttpServletRequest request, Long prjId, Long id, Long purposeCd) {
        BaseLogUtils.newWebLogger("===产品详细信息参数:" + this.getRequestParameter(request)).info();
        String prdDetailId = request.getParameter("id");//车型id
        String prdDtlId = request.getParameter("id");// 产品明细ID
        String carSourceId = request.getParameter("carSourceId");
        String insRoutePrdId = request.getParameter("insRoutePrdId");
        //换车标志
        String prjPrdChangeFlag = request.getParameter("prjPrdChangeFlag");
        String oldDtlId = request.getParameter("oldDtlId");
        String paySchId = request.getParameter("paySchId");
        String paySchNo = request.getParameter("paySchNo");
        BaseLogUtils.newWebLogger("==获取车源id=carSourceId:" + carSourceId).info();
        // 产品计量单位类型
        List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
        // 品牌类别
        List<KeyValueVO> brTypCdList = this.prjBscInfoService.getBrTypCdList();
        // 产品种类
        List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();
        // 保险购买方式
        List<KeyValueVO> buyWayCdList = this.prjBscInfoService.getBuyWayCdList();
        List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
        List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();

        ModelAndView view = new ModelAndView("project/vehicle/projectPrdInfoAddByHC");
        view.addObject("prjPrdChangeFlag", prjPrdChangeFlag);
        view.addObject("paySchId", paySchId);
        view.addObject("paySchNo", paySchNo);
        view.addObject("oldDtlId", oldDtlId);

        PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        List<KeyValueVO> keyValueVOList = new ArrayList<>();
        //非车抵贷业务收款方类型只有经销商  -》返回收款方列表
        KeyValueVO keyValueVO = new KeyValueVO();
        keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
        keyValueVO.setValue("供应商");
        keyValueVOList.add(keyValueVO);
        view.addObject("receiveTypeCdList", keyValueVOList);
        String receiveTypeCd = CapitalConstant.CODE_PAYEE_TYP_CD_1;
        //前置征信客户ID
        RcCstBscInfoDTO rcCstBscInfo = null;
        Boolean isCheck = false;
        if (StringUtils.isNotEmpty(bscVo.getRcCstBscInfoId())) {
            isCheck = true;
            //获取原来的供货商
            rcCstBscInfo = riskCtrlSearchApiService.getRcCstBscInfoById(bscVo.getRcCstBscInfoId());
        }
        Long accId = null;//供应商账号id
        String accNo = "";//供应商账号
        //供应商返利
        Long backAccId = null;
        String backAccNo = "";
        Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
        //销售返利
        Long salBackAccId = null;
        String salBackAccNo = "";
        Integer hasSalBackNo = BaseConstant.IS_YESNO_NO;
        //是否有放款账号-页面控制只读
        Integer hasAccNoFlag = BaseConstant.IS_YESNO_YES;
        //是否已经有了返利账号-页面控制只读
        Integer hasBackNoFlag = BaseConstant.IS_YESNO_YES;

        //代偿担保账号
        Long compensatoryAccId = null;//代偿担保账号id
        String compensatoryAccNo = "";//代偿担保账号
        String compensatorySplRcptUnt = "";//代偿支付账户
        String compensatorySplBkNm = "";//代偿担保账号开户行
        String compensatorySplBkNo = "";//代偿担保开户行行号

        Long depositAccId = null;//保证金担保账号id
        String depositAccNo = "";//保证金担保账号
        String depositSplRcptUnt = "";//保证金支付账户
        String depositSplBkNm = "";//保证金担保账号开户行
        String depositSplBkNo = "";//保证金担保开户行行号
        String compensatoryType = bscVo.getCompensatoryType() == null ? "0" : bscVo.getCompensatoryType();
        view.addObject("compensatoryType", compensatoryType);

        boolean tkFlag = false;
        List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();

        //查询是否有返利账号，如果有则直接带出不能修改
        if (StringUtils.isNotEmpty(oldDtlId)) {
            PrjPrdDtlVO prjPrdDtlVO = this.prjPrdDtlService.selectById(Long.valueOf(oldDtlId));
            if (prjPrdDtlVO != null && prjPrdDtlVO.getPrjPrdId() != null) {
                PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(prjPrdDtlVO.getPrjPrdId());
                if (prdBscInfoVO != null) {
                    //可编辑推荐经销商
                    view.addObject("recommendSplId", prdBscInfoVO.getRecommendSplId());
                    view.addObject("recommendSplNm", prdBscInfoVO.getRecommendSplNm());
                    view.addObject("isCanEditRecommendSpl", "0");
                    view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
                    view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());

                    view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
                    if (StringUtils.isNotEmpty(prdBscInfoVO.getReceiveTypeCd())) {
                        receiveTypeCd = prdBscInfoVO.getReceiveTypeCd();
                    }
                    //查找返利账号，销售返利账号
                    PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
                    accQc.setPrjPrdId(prdBscInfoVO.getId());
                    List<PrjSplBankAccRVO> splBankAccRVOList = this.prjSplBankAccRService.searchList(accQc);
                    if (CollectionUtils.isNotEmpty(splBankAccRVOList)) {
                        for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
                            if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
                                accId = prjSplBankAccRVO.getSplAccNoId();
                                if (CapitalConstant.CODE_PAYEE_TYP_CD_2.equals(receiveTypeCd) || CapitalConstant.CODE_PAYEE_TYP_CD_8.equals(receiveTypeCd)) {
                                    CstBankDTO dto = this.customerApiService.selectCstBankById(accId);
                                    if (dto != null) {
                                        accNo = dto.getAccNo();
                                    }
                                } else {
                                    SplBankVO splBankVO = splBankService.selectById(accId);
                                    if (splBankVO != null) {
                                        accNo = splBankVO.getAccNo();
                                    }
                                }
                            }
                            if (prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)) {
                                backAccId = prjSplBankAccRVO.getSplAccNoId();
                                hasSplBackNo = BaseConstant.IS_YESNO_YES;
                                SplBankVO splBackAccVO = splBankService.selectById(backAccId);
                                if (null != splBackAccVO) {
                                    backAccNo = splBackAccVO.getAccNo();
                                }
                            }
                            if (prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP)) {
                                salBackAccId = prjSplBankAccRVO.getSplAccNoId();
                                hasSalBackNo = BaseConstant.IS_YESNO_YES;
                                SaleRebAccInfoVO saleRebAccInfoVO = saleRebAccInfoService.selectById(salBackAccId);
                                if (saleRebAccInfoVO != null) {
                                    salBackAccNo = saleRebAccInfoVO.getAccNo();
                                }
                            }
                            //渠道为经销商 取经销商账号
                            if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP)) {
                                compensatoryAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                                SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                                if (null != splBankVO) {
                                    compensatoryAccNo = splBankVO.getAccNo();
                                    compensatorySplRcptUnt = splBankVO.getRcptUnt();
                                    compensatorySplBkNm = splBankVO.getBkNm();
                                    compensatorySplBkNo = splBankVO.getBkNo();
                                }
                            }
                            //渠道为挂靠公司 取挂靠公司账号
                            if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_COMPENSATORY_BANK_NO_TYP)) {
                                compensatoryAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                                PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                                if (null != prjLnkCompBkAccDTO) {
                                    compensatoryAccNo = prjLnkCompBkAccDTO.getAccNo();
                                    compensatorySplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                    compensatorySplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                    compensatorySplBkNo = prjLnkCompBkAccDTO.getBkNo();
                                }
                            }

                            //渠道为经销商 取经销商账号
                            if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_DEPOSIT_BANK_NO_TYP)) {
                                depositAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                                SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                                if (null != splBankVO) {
                                    depositAccNo = splBankVO.getAccNo();
                                    depositSplRcptUnt = splBankVO.getRcptUnt();
                                    depositSplBkNm = splBankVO.getBkNm();
                                    depositSplBkNo = splBankVO.getBkNo();
                                }
                            }
                            //渠道为挂靠公司 取挂靠公司账号
                            if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_DEPOSIT_BANK_NO_TYP)) {
                                depositAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                                PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                                if (null != prjLnkCompBkAccDTO) {
                                    depositAccNo = prjLnkCompBkAccDTO.getAccNo();
                                    depositSplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                                    depositSplBkNm = prjLnkCompBkAccDTO.getBkNm();
                                    depositSplBkNo = prjLnkCompBkAccDTO.getBkNo();
                                }
                            }
                        }
                    }
                    view.addObject("splId", prdBscInfoVO.getSplId());
                    view.addObject("splNm", prdBscInfoVO.getSplNm());
                }

                //代偿担保账号
                view.addObject("guaranteePaymentType", prdBscInfoVO.getGuaranteePaymentType());
                view.addObject("guaranteePaymentId", prdBscInfoVO.getGuaranteePaymentId());
                view.addObject("guaranteePaymentNm", prdBscInfoVO.getGuaranteePaymentNm());
                if(PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())){
                    view.addObject("guaranteePaymentTypeNm", "经销商");
                }
                if(PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())){
                    view.addObject("guaranteePaymentTypeNm", "挂靠公司");
                }
                view.addObject("compensatorySplAccNoId", compensatoryAccId);
                view.addObject("compensatorySplAccNoNm", compensatoryAccNo);
                view.addObject("compensatorySplRcptUnt", compensatorySplRcptUnt);
                view.addObject("compensatorySplBkNm", compensatorySplBkNm);
                view.addObject("compensatorySplBkNo", compensatorySplBkNo);

                view.addObject("depositSplAccNoId", depositAccId);
                view.addObject("depositSplAccNoNm", depositAccNo);
                view.addObject("depositSplRcptUnt", depositSplRcptUnt);
                view.addObject("depositSplBkNm", depositSplBkNm);
                view.addObject("depositSplBkNo", depositSplBkNo);
            }
        }

        view.addObject("receiveTypeCd", receiveTypeCd);
        //是否默认供应商
        view.addObject("isCheck", isCheck);
        /*if (!(StringUtils.isNotBlank(bscVo.getPrjTypCd())
                && bscVo.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL)
                && !(receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_1)))) {//车抵贷业务
            if (rcCstBscInfo != null) {
                view.addObject("splId", rcCstBscInfo.getSplId());
                view.addObject("splNm", rcCstBscInfo.getSplNm());
            }
        }*/
        view.addObject("styleId", id);
        view.addObject("prdDetailId", prdDetailId);
        view.addObject("prdUntCdList", prdUntCdList);
        view.addObject("yesNoCdList", yesNoCdList);
        view.addObject("vehCheckCdList", vehCheckCdList);
        view.addObject("tkFlag", tkFlag);
        view.addObject("prjId", prjId);
        view.addObject("prdDtlId", prdDtlId);
        view.addObject("brTypCdList", brTypCdList);
        view.addObject("prdClsCdList", prdClsCdList);
        view.addObject("buyWayCdList", buyWayCdList);
        view.addObject("buOrgCd", bscVo.getBuOrgCd());
        view.addObject("prjTypCd", bscVo.getPrjTypCd());
        view.addObject("isSplMfr", bscVo.getIsSplMfr());
        view.addObject("insCode", bscVo.getInsCode());
        view.addObject("accId", accId);
        view.addObject("accNo", accNo);
        view.addObject("backAccId", backAccId);
        view.addObject("backAccNo", backAccNo);
        view.addObject("hasAccNoFlag", hasAccNoFlag);
        view.addObject("hasSplBackNo", hasSplBackNo);
        view.addObject("hasBackNoFlag", hasBackNoFlag);
        view.addObject("salBackAccId", salBackAccId);
        view.addObject("salBackAccNo", salBackAccNo);
        view.addObject("hasSalBackNo", hasSalBackNo);
        view.addObject("licenseCdList", licenseCdList);
        String pCd = "";
        if (StringUtils.isNotBlank(carSourceId)) {
            view.addObject("prdTypCd", purposeCd);
        } else {
            pCd = this.vehicleStyleService.getPurposePCd(purposeCd);
            view.addObject("prdTypCd", pCd);
        }
        // 参配信息动态页面bizCd 这个需要组织机构
        view.addObject("bizCd", bscVo.getBuOrgCd() + pCd);
        // 二手车页面bizCd 这个不需要区分组织机构
        view.addObject("simpleBizCd", pCd);
        view.addObject("pCd", purposeCd);
        view.addObject("bizTypCd", "CVM0001");
        //二级分类
        view.addObject("prdCd", purposeCd);
        view.addObject("carSourceId", carSourceId);
        if (StringUtils.isNotEmpty(insRoutePrdId)) {
            InsRoutePrdInfoVO insRoutePrdInfoVO = this.insRoutePrdInfoService.selectById(Long.valueOf(insRoutePrdId));
            if (insRoutePrdInfoVO != null) {
                view.addObject("prdQty", insRoutePrdInfoVO.getPrdQty());
            }
        }
        view.addObject("insRoutePrdId", insRoutePrdId);
        //是否展示二手车车辆评估检测报告
        view.addObject("isShowPdfFilepath", false);
        BaseLogUtils.newLogger("toPrjPrdDetailPageByHC.view:{},操作人:{}", JSONObject.toJSONString(view), CurrentThreadContext.getCurrentUserName()).info();
        return view;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toModifyPageHC.do", method = { RequestMethod.GET, RequestMethod.POST })
    public ModelAndView toModifyPageHC(HttpServletRequest request, HttpServletResponse response) {
        String id = request.getParameter("id");
        String prdDetailId = request.getParameter("id");
        String prjId = request.getParameter("prjId");
        String detailFlag = request.getParameter("detailFlag");
        String isDetail = request.getParameter("isDetail");//信审节点标识  1:其他节点 0:信审节点
        //换车标志
        String prjPrdChangeFlag = request.getParameter("prjPrdChangeFlag");
        String oldDtlId = request.getParameter("oldDtlId");
        String paySchId = request.getParameter("paySchId");
        String paySchNo = request.getParameter("paySchNo");
        ModelAndView view = new ModelAndView("project/vehicle/projectPrdInfoAddByHC");
        view.addObject("isDetail", isDetail);
        view.addObject("prjPrdChangeFlag", prjPrdChangeFlag);
        view.addObject("paySchId", paySchId);
        view.addObject("paySchNo", paySchNo);
        view.addObject("oldDtlId", oldDtlId);

        //厂商指导价展示标志
        view.addObject("mfrGuidePcShowFlag", getMfrGuidePcShowFlag(CurrentThreadContext.getCurrentRoleId()));
        //获取项目基础及明细信息
        PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(Long.valueOf(id));
        List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService.searchYesOrNoCdList();
        List<KeyValueVO> vehCheckCdList = this.prjQuatPrpsCfgMService.searchVehCheckCdList();

        PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));
        List<KeyValueVO> keyValueVOList = new ArrayList<>();
        //非车抵贷业务收款方类型只有经销商  -》返回收款方列表
        KeyValueVO keyValueVO = new KeyValueVO();
        keyValueVO.setKey(CapitalConstant.CODE_PAYEE_TYP_CD_1);
        keyValueVO.setValue("供应商");
        keyValueVOList.add(keyValueVO);
        view.addObject("receiveTypeCdList",keyValueVOList);
        String receiveTypeCd = prdBscInfoVO.getReceiveTypeCd();
        if(StringUtils.isBlank(receiveTypeCd)){
            receiveTypeCd = CapitalConstant.CODE_PAYEE_TYP_CD_1;
        }
        view.addObject("receiveTypeCd",receiveTypeCd);
        Long accId = null;//供应商账号id
        String accNo = "";//供应商账号
        //供应商返利
        Long backAccId = null;
        String backAccNo = "";
        Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;

        //销售返利
        Long salBackAccId = null;
        String salBackAccNo="";
        Integer hasSalBackNo = BaseConstant.IS_YESNO_NO;

        //代偿担保账号
        Long compensatoryAccId = null;//代偿担保账号id
        String compensatoryAccNo = "";//代偿担保账号
        String compensatorySplRcptUnt = "";//代偿支付账户
        String compensatorySplBkNm = "";//代偿担保账号开户行
        String compensatorySplBkNo = "";//代偿担保开户行行号

        Long depositAccId = null;//保证金担保账号id
        String depositAccNo = "";//保证金担保账号
        String depositSplRcptUnt = "";//保证金支付账户
        String depositSplBkNm = "";//保证金担保账号开户行
        String depositSplBkNo = "";//保证金担保开户行行号
        String compensatoryType = bscVo.getCompensatoryType() == null ? "0" : bscVo.getCompensatoryType();
        view.addObject("compensatoryType", compensatoryType);

        Integer hasAccNoFlag = BaseConstant.IS_YESNO_YES;
        Integer hasBackNoFlag = BaseConstant.IS_YESNO_YES;
        PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
        accQc.setPrjPrdId(Long.valueOf(id));
        List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
        if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
            for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BANK_NO_TP)){
                    accId = prjSplBankAccRVO.getSplAccNoId();
                    if (CapitalConstant.CODE_PAYEE_TYP_CD_2.equals(receiveTypeCd) || CapitalConstant.CODE_PAYEE_TYP_CD_8.equals(receiveTypeCd)) {
                        CstBankVO cstBankVO = this.cstBankService.selectById(accId);
                        if (cstBankVO != null) {
                            accNo = cstBankVO.getAccNo();
                        }
                    } else {
                        SplBankVO splBankVO = splBankService.selectById(accId);
                        if (splBankVO != null) {
                            accNo = splBankVO.getAccNo();
                        }
                    }
                }
                if(prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP)){
                    backAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSplBackNo = BaseConstant.IS_YESNO_YES;
                    SplBankVO splBackAccVO = splBankService.selectById(backAccId);
                    if (null != splBackAccVO) {
                        backAccNo = splBackAccVO.getAccNo();
                    }
                }
                if (prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP)) {
                    salBackAccId = prjSplBankAccRVO.getSplAccNoId();
                    hasSalBackNo = BaseConstant.IS_YESNO_YES;
                    SaleRebAccInfoVO saleRebAccInfoVO = saleRebAccInfoService.selectById(salBackAccId);
                    if (saleRebAccInfoVO != null) {
                        salBackAccNo = saleRebAccInfoVO.getAccNo();
                    }
                }
                //渠道为经销商 取经销商账号
                if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP)) {
                    compensatoryAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                    SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                    if (null != splBankVO) {
                        compensatoryAccNo = splBankVO.getAccNo();
                        compensatorySplRcptUnt = splBankVO.getRcptUnt();
                        compensatorySplBkNm = splBankVO.getBkNm();
                        compensatorySplBkNo = splBankVO.getBkNo();
                    }
                }
                //渠道为挂靠公司 取挂靠公司账号
                if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_COMPENSATORY_BANK_NO_TYP)) {
                    compensatoryAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                    PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                    if (null != prjLnkCompBkAccDTO) {
                        compensatoryAccNo = prjLnkCompBkAccDTO.getAccNo();
                        compensatorySplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                        compensatorySplBkNm = prjLnkCompBkAccDTO.getBkNm();
                        compensatorySplBkNo = prjLnkCompBkAccDTO.getBkNo();
                    }
                }

                //渠道为经销商 取经销商账号
                if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.SPL_DEPOSIT_BANK_NO_TYP)) {
                    depositAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                    SplBankVO splBankVO = this.prdSplBankService.selectById(compensatoryAccId);
                    if (null != splBankVO) {
                        depositAccNo = splBankVO.getAccNo();
                        depositSplRcptUnt = splBankVO.getRcptUnt();
                        depositSplBkNm = splBankVO.getBkNm();
                        depositSplBkNo = splBankVO.getBkNo();
                    }
                }
                //渠道为挂靠公司 取挂靠公司账号
                if (PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())&& prjSplBankAccRVO.getPurpCd().equals(PrjPrdBscInfoConstant.LNKCOMP_DEPOSIT_BANK_NO_TYP)) {
                    depositAccId = prjSplBankAccRVO.getSplAccNoId();//查询供应商账号信息
                    PrjLnkCompBkAccDTO prjLnkCompBkAccDTO = this.prjLnkCompQueryApiService.selectPrjLnkCompBkAccById(depositAccId,"11000","0000");
                    if (null != prjLnkCompBkAccDTO) {
                        depositAccNo = prjLnkCompBkAccDTO.getAccNo();
                        depositSplRcptUnt = prjLnkCompBkAccDTO.getRcptUnt();
                        depositSplBkNm = prjLnkCompBkAccDTO.getBkNm();
                        depositSplBkNo = prjLnkCompBkAccDTO.getBkNo();
                    }
                }
            }
        }

        //是否可编辑推荐经销商
        view.addObject("isCanEditRecommendSpl", "0");
        view.addObject("recommendSplId", prdBscInfoVO.getRecommendSplId());
        view.addObject("recommendSplNm", prdBscInfoVO.getRecommendSplNm());

        view.addObject("splId", prdBscInfoVO.getSplId());
        view.addObject("splNm", prdBscInfoVO.getSplNm());

        view.addObject("guaranteePaymentType", prdBscInfoVO.getGuaranteePaymentType());
        view.addObject("guaranteePaymentId", prdBscInfoVO.getGuaranteePaymentId());
        view.addObject("guaranteePaymentNm", prdBscInfoVO.getGuaranteePaymentNm());
        if(PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_01.equals(prdBscInfoVO.getGuaranteePaymentType())){
            view.addObject("guaranteePaymentTypeNm", "经销商");
        }
        if(PrjPrdBscInfoConstant.GUARANTEE_PAYMENT_TYPE_02.equals(prdBscInfoVO.getGuaranteePaymentType())){
            view.addObject("guaranteePaymentTypeNm", "挂靠公司");
        }
        view.addObject("compensatorySplAccNoId", compensatoryAccId);
        view.addObject("compensatorySplAccNoNm", compensatoryAccNo);
        view.addObject("compensatorySplRcptUnt", compensatorySplRcptUnt);
        view.addObject("compensatorySplBkNm", compensatorySplBkNm);
        view.addObject("compensatorySplBkNo", compensatorySplBkNo);

        view.addObject("depositSplAccNoId", depositAccId);
        view.addObject("depositSplAccNoNm", depositAccNo);
        view.addObject("depositSplRcptUnt", depositSplRcptUnt);
        view.addObject("depositSplBkNm", depositSplBkNm);
        view.addObject("depositSplBkNo", depositSplBkNo);

        //品牌类别
        List<KeyValueVO> brTypCdList  =  this.prjBscInfoService.getBrTypCdList();
        //产品种类
        List<KeyValueVO> prdClsCdList = this.prjBscInfoService.getPrdClsCdList();

        //产品计量单位类型
        List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
        //产品计量单位类型
        List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();

        view.addObject("id", id);
        view.addObject("prdBscInfoVO", prdBscInfoVO);
        view.addObject("yesNoCdList",yesNoCdList);
        view.addObject("vehCheckCdList",vehCheckCdList);
        view.addObject("modifyFlag",true);
        view.addObject("prdDetailId", prdDetailId);
        view.addObject("prdUntCdList",prdUntCdList );
        view.addObject("prdCd",  prdBscInfoVO.getPrdCd());
        view.addObject("pCd",  prdBscInfoVO.getPrdCd());
        view.addObject("prdTypCd",  prdBscInfoVO.getPrdTypCd());
        view.addObject("bizTypCd","CVM0001");
        view.addObject("bizCd", bscVo.getBuOrgCd() + prdBscInfoVO.getPrdTypCd());
        view.addObject("prjId", prjId);
        view.addObject("splId", prdBscInfoVO.getSplId());
        view.addObject("splNm", prdBscInfoVO.getSplNm());
        view.addObject("licenseCdList", licenseCdList);
        view.addObject("splMfrId", prdBscInfoVO.getSplMfrId());
        view.addObject("splMfrNm", prdBscInfoVO.getSplMfrNm());

        view.addObject("splBanNo", prdBscInfoVO.getSplAccNoId());
        view.addObject("detailFlag", detailFlag);
        view.addObject("brTypCdList", brTypCdList);
        view.addObject("prdClsCdList", prdClsCdList);
        view.addObject("buOrgCd", bscVo.getBuOrgCd());
        view.addObject("prjTypCd", bscVo.getPrjTypCd());
        view.addObject("isSplMfr", bscVo.getIsSplMfr());
        view.addObject("insCode", bscVo.getInsCode());
        view.addObject("accId", accId);
        view.addObject("accNo", accNo);
        view.addObject("backAccId", backAccId);
        view.addObject("backAccNo", backAccNo);
        view.addObject("hasSplBackNo", hasSplBackNo);
        view.addObject("salBackAccId", salBackAccId);
        view.addObject("salBackAccNo", salBackAccNo);
        view.addObject("hasSalBackNo", hasSalBackNo);
        view.addObject("hasBackNoFlag", hasBackNoFlag);
        view.addObject("hasAccNoFlag", hasAccNoFlag);
        BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * 产品明细页面厂商指导价展示标志
     * @param roleId 用户角色ID
     * 0-不展示,1-展示
     * @return
     */
    public String getMfrGuidePcShowFlag(Long roleId){
        String mfrGuidePcShowFlag = "0"; //默认不展示
        if (roleId == null) {
            return mfrGuidePcShowFlag;
        }
        SysRoleDTO sysRoleDTO = priorityApiService.selectSysRoleById(roleId);
        BaseLogUtils.newLogger("getMfrGuidePcShowFlag start 角色ID={},角色信息sysRoleDTO={},"
                ,roleId,JSON.toJSONString(sysRoleDTO)).info();
        if (sysRoleDTO == null) {
            return mfrGuidePcShowFlag;
        }
        if ("信审员".equals(sysRoleDTO.getRoleNm())
                || "风险制度经理".equals(sysRoleDTO.getRoleNm())
                || "录单员".equals(sysRoleDTO.getRoleNm())) {
            mfrGuidePcShowFlag = "1";
        }
        return mfrGuidePcShowFlag;
    }

}
